-(* let bo'' = *)
-(* C.Appl ([C.MutInd (HL.Logic.eq_URI, 0, []); *)
-(* S.lift 1 eq_ty] @ *)
-(* if is_left then [S.lift 1 bo; S.lift 1 right] *)
-(* else [S.lift 1 left; S.lift 1 bo]) *)
-(* in *)
-(* let t' = *)
-(* let name = C.Name ("x_Demod_" ^ (string_of_int !demod_counter)) in *)
-(* incr demod_counter; *)
-(* C.Lambda (name, ty, bo'') *)
-(* in *)
- bo,
- Inference.ProofBlock (subst, eq_URI, t', eq_found, target)
-(* (\* M. *\)apply_subst subst (C.Appl [C.Const (eq_URI, []); ty; what; t'; *)
-(* proof; other; proof']) *)
+ if sign = Utils.Positive then
+ (bo,
+ Inference.ProofBlock (subst, eq_URI, t', eq_found, proof))
+ else
+ let metaproof =
+ incr maxmeta;
+ let irl =
+ CicMkImplicit.identity_relocation_list_for_metavariable context in
+ Printf.printf "\nADDING META: %d\n" !maxmeta;
+ print_newline ();
+ C.Meta (!maxmeta, irl)
+ in
+ let target' =
+ let eq_found =
+ let proof' =
+ let ens =
+ if pos = Utils.Left then
+ build_ens_for_sym_eq ty what other
+ else
+ build_ens_for_sym_eq ty other what
+ in
+ Inference.ProofSymBlock (ens, proof')
+ in
+ let what, other =
+ if pos = Utils.Left then what, other else other, what
+ in
+ pos, (0, proof', (ty, other, what, Utils.Incomparable),
+ menv', args')
+ in
+ let target_proof =
+ let pb =
+ Inference.ProofBlock (subst, eq_URI, t', eq_found,
+ Inference.BasicProof metaproof)
+ in
+ match proof with
+ | Inference.BasicProof _ ->
+ print_endline "replacing a BasicProof";
+ pb
+ | Inference.ProofGoalBlock (_, parent_eq) ->
+ print_endline "replacing another ProofGoalBlock";
+ Inference.ProofGoalBlock (pb, parent_eq)
+ | _ -> assert false
+ in
+ (0, target_proof, (eq_ty, left, right, order), metas, args)
+ in
+ let refl =
+ C.Appl [C.MutConstruct (* reflexivity *)
+ (HelmLibraryObjects.Logic.eq_URI, 0, 1, []);
+ eq_ty; if is_left then right else left]
+ in
+ (bo,
+ Inference.ProofGoalBlock (Inference.BasicProof refl, target'))