(* Takes a well-typed term and fully reduces it. *)
(*CSC: It does not perform reduction in a Case *)
-let reduce =
+let reduce context =
let rec reduceaux l =
let module C = Cic in
let module S = CicSubstitution in
(* change in every iteration, i.e. to the actual arguments for the *)
(* lambda-abstractions that precede the Fix. *)
(*CSC: It does not perform simplification in a Case *)
-let simpl =
+let simpl context =
(* reduceaux is equal to the reduceaux locally defined inside *)
(*reduce, but for the const case. *)
(**** Step 1 ****)
with
_ -> raise AlreadySimplified
in
- (match CicReduction.whd recparam with
+ (match CicReduction.whd context recparam with
C.MutConstruct _
| C.Appl ((C.MutConstruct _)::_) ->
let body' =
[] -> C.Const (uri,cookingsno)
| _ -> C.Appl ((C.Const (uri,cookingsno))::constant_args)
in
- let reduced_term_to_fold = reduce term_to_fold in
+ let reduced_term_to_fold = reduce context term_to_fold in
prerr_endline ("TERM TO FOLD: " ^ CicPp.ppterm term_to_fold) ; flush stderr ;
prerr_endline ("REDUCED TERM TO FOLD: " ^ CicPp.ppterm reduced_term_to_fold) ; flush stderr ;
replace reduced_term_to_fold term_to_fold res