let split2_last l1 l2 =
try
let n = pred (List.length l1) in
- let before1, after1 = HEL.split_nth n l1 in
- let before2, after2 = HEL.split_nth n l2 in
+ let before1, after1 = HEL.split_nth "P2 1" n l1 in
+ let before2, after2 = HEL.split_nth "P2 2" n l2 in
before1, before2, List.hd after1, List.hd after2
with Invalid_argument _ -> failwith "A2P.split2_last"
| None -> [T.Change (sty, ety, None, e, note)]
| Some (id, i) ->
begin match get_entry st id with
- | C.Def _ -> assert false (* T.ClearBody (id, "") :: script *)
+ | C.Def _ ->
+ [T.Change (ety, sty, Some (id, Some id), e, note);
+ T.ClearBody (id, "")
+ ]
| C.Decl _ ->
[T.Change (ety, sty, Some (id, Some id), e, note)]
end
let intro = get_intro name in
let proceed, dtext = test_depth st in
let script = if proceed then
- let st, hyp, rqv = match get_inner_types st v with
- | Some (ity, _) ->
+ let st, hyp, rqv = match get_inner_types st what, get_inner_types st v with
+ | Some (C.ALetIn _, _), _ ->
+ st, C.Def (H.cic v, H.cic w), [T.Intros (Some 1, [intro], dtext)]
+ | _, Some (ity, _) ->
let st, rqv = match v with
| C.AAppl (_, hd :: tl) when is_fwd_rewrite_right st hd tl ->
mk_fwd_rewrite st dtext intro tl true v t ity
st, [T.Branch (qs, ""); T.Cut (intro, ity, dtext)]
in
st, C.Decl (H.cic ity), rqv
- | None ->
+ | _, None ->
st, C.Def (H.cic v, H.cic w), [T.LetIn (intro, v, dtext)]
in
let entry = Some (name, hyp) in
let qs = proc_bkd_proofs (next st) synth names classes ts in
let lpsno, _ = H.get_ind_type uri tyno in
let ps, _ = H.get_ind_parameters st.context (H.cic v) in
- let _, rps = HEL.split_nth lpsno ps in
+ let _, rps = HEL.split_nth "P2 3" lpsno ps in
let rpsno = List.length rps in
let e = Cn.mk_pattern rpsno u in
let text = "" in