-let rec build_term_proof equality =
-(* Printf.printf "build_term_proof %s" (string_of_equality equality); *)
-(* print_newline (); *)
- let proof = try Hashtbl.find prooftable equality with Not_found -> NoProof in
- match proof with
- | NoProof ->
- Printf.fprintf stderr "WARNING: no proof for %s\n"
- (string_of_equality equality);
- Cic.Implicit None
- | BasicProof term -> term
- | ProofBlock (subst, eq_URI, t', (pos, eq), eq') ->
-(* Printf.printf " ProofBlock: eq = %s, eq' = %s" *)
-(* (string_of_equality eq) (string_of_equality eq'); *)
-(* print_newline (); *)
- let proof' = build_term_proof eq in
- let eqproof = build_term_proof eq' in
- let _, (ty, what, other, _), menv', args' = eq in
- let what, other = if pos = Utils.Left then what, other else other, what in
- CicMetaSubst.apply_subst subst
- (Cic.Appl [Cic.Const (eq_URI, []); ty;
- what; t'; eqproof; other; proof'])
+ let eqproof = do_build_proof eqproof in
+
+(* print_endline (s ^ "END eqproof"); *)
+(* decr indent; *)
+
+
+ let _, _, (ty, what, other, _), menv', args' = eq in
+ let what, other =
+ if pos = Utils.Left then what, other else other, what
+ in
+ CicMetaSubst.apply_subst subst
+ (Cic.Appl [Cic.Const (eq_URI, []); ty;
+ what; t'; eqproof; other; proof'])
+
+ and do_build_goal_proof proofbit proof =
+(* match proofbit with *)
+(* | BasicProof _ -> do_build_proof proof *)
+(* | proofbit -> *)
+ match proof with
+ | ProofGoalBlock (pb, eq) ->
+ do_build_proof (ProofGoalBlock (replace_proof proofbit pb, eq))
+(* let _, proof, _, _, _ = eq in *)
+(* let newproof = replace_proof proofbit proof in *)
+(* do_build_proof newproof *)
+
+(* | ProofBlock (subst, eq_URI, t', poseq, eqproof) -> *)
+(* let eqproof' = replace_proof proofbit eqproof in *)
+(* do_build_proof (ProofBlock (subst, eq_URI, t', poseq, eqproof')) *)
+ | _ -> do_build_proof (replace_proof proofbit proof) (* assert false *)
+
+ and replace_proof newproof = function
+ | ProofBlock (subst, eq_URI, t', poseq, eqproof) ->
+ let uri = eq_URI in
+(* if eq_URI = HelmLibraryObjects.Logic.eq_ind_URI then *)
+(* HelmLibraryObjects.Logic.eq_ind_r_URI *)
+(* else *)
+(* HelmLibraryObjects.Logic.eq_ind_URI *)
+(* in *)
+ let eqproof' = replace_proof newproof eqproof in
+ ProofBlock (subst, uri(* eq_URI *), t', poseq, eqproof')
+(* ProofBlock (subst, eq_URI, t', poseq, newproof) *)
+ | ProofGoalBlock (pb, equality) ->
+ let pb' = replace_proof newproof pb in
+ ProofGoalBlock (pb', equality)
+(* let w, proof, t, menv, args = equality in *)
+(* let proof' = replace_proof newproof proof in *)
+(* ProofGoalBlock (pb, (w, proof', t, menv, args)) *)
+ | BasicProof _ -> newproof
+ | p -> p
+ in
+ let _, proof, _, _, _ = equality in
+ do_build_proof proof