diff options
-rw-r--r-- | dev/changements.txt | 4 | ||||
-rw-r--r-- | kernel/reduction.ml | 30 | ||||
-rw-r--r-- | kernel/reduction.mli | 20 | ||||
-rw-r--r-- | proofs/clenv.ml | 14 | ||||
-rw-r--r-- | proofs/refiner.ml | 2 |
5 files changed, 37 insertions, 33 deletions
diff --git a/dev/changements.txt b/dev/changements.txt index 3ea6557ba..f247062e3 100644 --- a/dev/changements.txt +++ b/dev/changements.txt @@ -76,6 +76,10 @@ Changements dans les fonctions : type_of_type -> judge_of_type fcn_proposition -> judge_of_prop_contents + Reduction, Clenv + whd_betadeltat -> whd_betaevar + whd_betadeltatiota -> whd_betaiotaevar + Changements dans les inductifs ------------------------------ Nouveaux types "constructor" et "inductive" dans Term diff --git a/kernel/reduction.ml b/kernel/reduction.ml index f399dfdf0..b6101a436 100644 --- a/kernel/reduction.ml +++ b/kernel/reduction.ml @@ -381,14 +381,9 @@ let whd_betadelta_stack env sigma = let whd_betadelta env sigma c = applist(whd_betadelta_stack env sigma c []) -let whd_betadeltat_stack env sigma = +let whd_betaevar_stack env sigma = let rec whrec x l = match x with - | DOPN(Const _,_) -> - if evaluable_constant env x then - whrec (constant_value env x) l - else - (x,l) | DOPN(Evar ev,_) -> if Evd.is_defined sigma ev then whrec (existential_value sigma x) l @@ -405,11 +400,12 @@ let whd_betadeltat_stack env sigma = (match l with | [] -> (x,l) | (a::m) -> stacklam whrec [a] c m) + | DOPN(Const _,_) -> (x,l) | x -> (x,l) in whrec -let whd_betadeltat env sigma c = applist(whd_betadeltat_stack env sigma c []) +let whd_betaevar env sigma c = applist(whd_betaevar_stack env sigma c []) let whd_betadeltaeta_stack env sigma = let rec whrec x stack = @@ -560,14 +556,9 @@ let whd_betaiota_stack env sigma = let whd_betaiota env sigma x = applist (whd_betaiota_stack env sigma x []) -let whd_betadeltatiota_stack env sigma = +let whd_betaiotaevar_stack env sigma = let rec whrec x stack = match x with - | DOPN(Const _,_) -> - if evaluable_constant env x then - whrec (constant_value env x) stack - else - (x,stack) | DOPN(Evar ev,_) -> if Evd.is_defined sigma ev then whrec (existential_value sigma x) stack @@ -595,12 +586,13 @@ let whd_betadeltatiota_stack env sigma = | DOPN(Fix _,_) -> let (reduced,(fix,stack)) = reduce_fix whrec x stack in if reduced then whrec fix stack else (fix,stack) + | DOPN(Const _,_) -> (x,stack) | x -> (x,stack) in whrec -let whd_betadeltatiota env sigma x = - applist(whd_betadeltatiota_stack env sigma x []) +let whd_betaiotaevar env sigma x = + applist(whd_betaiotaevar_stack env sigma x []) let whd_betadeltaiota_stack env sigma = let rec bdi_rec x stack = @@ -1167,7 +1159,8 @@ let make_constructor_summary (hyps,lc,nconstr,ntypes) ind params = let make_arity env sigma (hyps,arity) ind params = let ((sp,i),ctxt) = ind in - let arity' = instantiate_type (Sign.ids_of_sign hyps) arity (Array.to_list ctxt) in + let arity' = + instantiate_type (Sign.ids_of_sign hyps) arity (Array.to_list ctxt) in match splay_prod env sigma (prod_applist (body_of_type arity') params) with | (sign, DOP0 (Sort s)) -> (sign,s) | _ -> anomaly "make_arity: the conclusion of this arity is not a sort" @@ -1312,11 +1305,16 @@ let rec whd_ise1 sigma = function else k | DOP2(Cast,c,_) -> whd_ise1 sigma c + (* A quoi servait cette ligne ??? | DOP0(Sort(Type _)) -> DOP0(Sort(Type dummy_univ)) + *) | c -> c let nf_ise1 sigma = strong (fun _ -> whd_ise1) empty_env sigma +(* A form of [whd_ise1] with type "reduction_function" *) +let whd_evar env = whd_ise1 + (* Same as whd_ise1, but replaces the remaining ISEVAR by Metavariables * Similarly we have is_fmachine1_metas and is_resolve1_metas *) diff --git a/kernel/reduction.mli b/kernel/reduction.mli index 6638f30ee..b953907db 100644 --- a/kernel/reduction.mli +++ b/kernel/reduction.mli @@ -66,14 +66,15 @@ val whd_delta_stack : 'a stack_reduction_function val whd_delta : 'a reduction_function val whd_betadelta_stack : 'a stack_reduction_function val whd_betadelta : 'a reduction_function -val whd_betadeltat_stack : 'a stack_reduction_function -val whd_betadeltat : 'a reduction_function -val whd_betadeltatiota_stack : 'a stack_reduction_function -val whd_betadeltatiota : 'a reduction_function +val whd_betaevar_stack : 'a stack_reduction_function +val whd_betaevar : 'a reduction_function +val whd_betaiotaevar_stack : 'a stack_reduction_function +val whd_betaiotaevar : 'a reduction_function val whd_betadeltaeta_stack : 'a stack_reduction_function val whd_betadeltaeta : 'a reduction_function val whd_betadeltaiotaeta_stack : 'a stack_reduction_function val whd_betadeltaiotaeta : 'a reduction_function +val whd_evar : 'a reduction_function val beta_applist : (constr * constr list) -> constr @@ -180,14 +181,15 @@ val whd_meta : (int * constr) list -> constr -> constr val plain_instance : (int * constr) list -> constr -> constr val instance : (int * constr) list -> 'a reduction_function -(* [whd_ise] raise [Uninstantiated_evar] if an evar remains uninstantiated *) -(* the *[_ise1]* leave uninstantiated evar as it *) +(* [whd_ise] raise [Uninstantiated_evar] if an evar remains uninstantiated; *) +(* *[whd_ise1]* is synonymous of *[whd_evar empty_env]* and *[nf_ise1]* of *) +(* *[strong whd_evar empty_env]*: they leave uninstantiated evar as it *) -exception Uninstantiated_evar of int - -val whd_ise : 'a evar_map -> constr -> constr val whd_ise1 : 'a evar_map -> constr -> constr val nf_ise1 : 'a evar_map -> constr -> constr +exception Uninstantiated_evar of int +val whd_ise : 'a evar_map -> constr -> constr + val whd_ise1_metas : 'a evar_map -> constr -> constr (*s Obsolete Reduction Functions *) diff --git a/proofs/clenv.ml b/proofs/clenv.ml index 0a44eff87..5973e22e9 100644 --- a/proofs/clenv.ml +++ b/proofs/clenv.ml @@ -38,10 +38,10 @@ let new_evar_in_sign env = DOPN(Evar ev, Array.of_list (List.map (fun id -> VAR id) (ids_of_sign hyps))) -let rec whd_deltat wc = function +let rec w_whd_evar wc = function | DOPN(Evar ev,_) as k -> if is_defined (w_Underlying wc) ev then - whd_deltat wc (w_const_value wc k) + w_whd_evar wc (w_const_value wc k) else collapse_appl k | t -> @@ -81,8 +81,8 @@ let mimick_evar hdc nargs sp wc = let unify_0 mc wc m n = let rec unirec_rec ((metasubst,evarsubst) as substn) m n = - let cM = whd_deltat wc m - and cN = whd_deltat wc n in + let cM = w_whd_evar wc m + and cN = w_whd_evar wc n in try match (cM,cN) with | DOP2(Cast,c,_),t2 -> unirec_rec substn c t2 @@ -166,7 +166,7 @@ let unify_0 mc wc m n = unirec_rec (mc,[]) m n -let whd_castappdeltat_stack sigma = +let whd_castappevar_stack sigma = let rec whrec x l = match x with | DOPN(Evar ev,_) as c -> @@ -180,9 +180,9 @@ let whd_castappdeltat_stack sigma = in whrec -let whd_castappdeltat sigma c = applist(whd_castappdeltat_stack sigma c []) +let whd_castappevar sigma c = applist(whd_castappevar_stack sigma c []) -let w_whd wc c = whd_castappdeltat (w_Underlying wc) c +let w_whd wc c = whd_castappevar (w_Underlying wc) c (* Unification * diff --git a/proofs/refiner.ml b/proofs/refiner.ml index c5e77abfb..3af874803 100644 --- a/proofs/refiner.ml +++ b/proofs/refiner.ml @@ -684,7 +684,7 @@ let extract_pftreestate pts = 'sPC; 'sTR"Please ascend to the root" >]; let env = pts.tpf.goal.evar_env in let hyps = Environ.var_context env in - strong whd_betadeltatiota env (ts_it pts.tpfsigma) + strong whd_betaiotaevar env (ts_it pts.tpfsigma) (extract_proof hyps pts.tpf) |