in
if pragma <> `Projection || List.length args <= rno then conclude ()
else
- (match List.nth args rno with
+ (match List.nth l (rno+1) with
| C.Appl (C.Const(Ref.Ref(_,Ref.Con _))::_) ->
let _, _, _, _, fbody = List.nth ifl fno in (* fbody is closed! *)
- let t = C.Appl (fbody::args) in
+ let t = C.Appl (fbody::List.tl l) in
(match NCicReduction.head_beta_reduce ~delta:max_int t with
- | C.Match (_,_,C.Appl(C.Const(Ref.Ref(_,Ref.Con (_,_,leftno)))::kargs),[pat])->
+ | C.Match (_,_, C.Appl(C.Const(Ref.Ref(_,Ref.Con (_,_,leftno)))
+ ::kargs),[pat])->
let _,kargs = HExtlib.split_nth leftno kargs in
- fire_projection_redex false
- (NCicReduction.head_beta_reduce
- ~delta:max_int (C.Appl (pat :: kargs)))
- | C.Appl(C.Match(_,_,C.Appl(C.Const(Ref.Ref(_,Ref.Con (_,_,leftno)))::kargs),[pat]) :: args) ->
+ fire_projection_redex false
+ (NCicReduction.head_beta_reduce
+ ~delta:max_int (C.Appl (pat :: kargs)))
+ | C.Appl(C.Match(_,_,C.Appl(C.Const(Ref.Ref(_,Ref.Con (_,_,leftno)))
+ ::kargs),[pat]) :: args) ->
let _,kargs = HExtlib.split_nth leftno kargs in
- fire_projection_redex false
- (NCicReduction.head_beta_reduce
- ~delta:max_int (C.Appl (pat :: kargs @ args)))
+ fire_projection_redex false
+ (NCicReduction.head_beta_reduce
+ ~delta:max_int (C.Appl (pat :: kargs @ args)))
| _ -> conclude ())
| _ -> conclude ())
| t when on_args -> NCicUtils.map (fun _ x -> x) true fire_projection_redex t