- let arity_l = cut_last (list_of_prod arity) in
- let rightparam_tys = cut_first nleft arity_l in
- let theorem = build_theorem rightparam_tys arity_l arity cons_list
- [](*created_vars*) [](*created_vars_ty*) nleft uri typeno in
- (*DEBUG*) debug_print (lazy ("theorem prima di refine: " ^ (CicPp.ppterm
- theorem)));
- let (ref_theorem,_,metasenv,_) = CicRefine.type_of_aux' [] [] theorem
- CicUniv.empty_ugraph in
- (*DEBUG*) debug_print (lazy ("theorem dopo refine: " ^ (CicPp.ppterm
- ref_theorem)));
- let buri = UriManager.buri_of_uri uri in
- let inversor_uri =
- UriManager.uri_of_string (buri ^ "/" ^ name ^ "_inv" ^ ".con") in
- let goal = CicMkImplicit.new_meta metasenv [] in
- let metasenv' = (goal,[],ref_theorem)::metasenv in
- let proof= (Some inversor_uri,metasenv',Cic.Meta(goal,[]),ref_theorem) in
- let _,applies =
- List.fold_right
- (fun _ (i,applies) ->
- i+1,PrimitiveTactics.apply_tac (Cic.Rel i)::applies)
- cons_list (2,[])
- in
- let proof1,gl1 =
- PET.apply_tactic
- (Tacticals.then_
- ~start:(PrimitiveTactics.intros_tac ())
- (*if the number of applies is 1, we cannot use thens, but then_*)
- ~continuation:
- (match (List.length applies) with
- 0 -> (Inversion.private_inversion_tac (Cic.Rel 1))
- | 1 -> (Tacticals.then_
- ~start:(Inversion.private_inversion_tac (Cic.Rel 1))
- ~continuation:(PrimitiveTactics.apply_tac (Cic.Rel 2))
- )
- | _ -> (Tacticals.thens
- ~start:(Inversion.private_inversion_tac (Cic.Rel 1))
- ~continuations:applies
- )
- ))
- (proof,goal)
- in
- let metasenv,bo,ty =
- match proof1 with (_,metasenv,bo,ty) -> metasenv,bo,ty
- in
- assert (metasenv = []);
- Some
- (inversor_uri,
- Cic.Constant (UriManager.name_of_uri inversor_uri,Some bo,ty,[],[]))
+ let arity_l = cut_last (list_of_prod arity) in
+ let rightparam_tys = cut_first nleft arity_l in
+ let theorem = build_theorem rightparam_tys arity_l arity cons_list
+ [](*created_vars*) [](*created_vars_ty*) nleft indty_uri typeno in
+ debug_print
+ (lazy ("theorem prima di refine: " ^ (CicPp.ppterm theorem)));
+ let (ref_theorem,_,metasenv,_) =
+ CicRefine.type_of_aux' [] [] theorem CicUniv.oblivion_ugraph in
+ (*DEBUG*) debug_print
+ (lazy ("theorem dopo refine: " ^ (CicPp.ppterm ref_theorem)));
+ let goal = CicMkImplicit.new_meta metasenv [] in
+ let metasenv' = (goal,[],ref_theorem)::metasenv in
+ let attrs = [`Class (`InversionPrinciple); `Generated] in
+ let _subst = [] in
+ let proof=
+ Some inversor_uri,metasenv',_subst,
+ lazy (Cic.Meta(goal,[])),ref_theorem, attrs in
+ let _,applies =
+ List.fold_right
+ (fun _ (i,applies) ->
+ i+1,PrimitiveTactics.apply_tac (Cic.Rel i)::applies
+ ) cons_list (2,[]) in
+ let proof1,gl1 =
+ ProofEngineTypes.apply_tactic
+ (Tacticals.then_
+ ~start:(PrimitiveTactics.intros_tac ())
+ (*if the number of applies is 1, we cannot use
+ thens, but then_*)
+ ~continuation:
+ (match List.length applies with
+ 0 -> Inversion.private_inversion_tac (Cic.Rel 1) selections
+ | 1 ->
+ Tacticals.then_
+ ~start:(Inversion.private_inversion_tac (Cic.Rel 1) selections)
+ ~continuation:(PrimitiveTactics.apply_tac (Cic.Rel 2))
+ | _ ->
+ Tacticals.thens
+ ~start:(Inversion.private_inversion_tac (Cic.Rel 1) selections)
+ ~continuations:applies))
+ (proof,goal) in
+ let _,metasenv,_subst,bo,ty, attrs = proof1 in
+ assert (metasenv = []);
+ Some
+ (inversor_uri,
+ Cic.Constant
+ (UriManager.name_of_uri inversor_uri,Some (Lazy.force bo),ty,[],[]))