Step
*
1
2
1
of Lemma
taba-property
1. A : Type
2. B : Type
3. init : B
4. F : A ⟶ A ⟶ B ⟶ B
5. xs : A List
6. u : A
7. v : A List
8. ∀ys:A List
((||v|| ≤ ||ys||)
⇒ (rec-case(v) of
[] => <init, ys>
x::xs' =>
p.let a,ys = p
in let h,t = ys
in <F[x;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v);firstn(||v||;ys))
with starting value:
init)
, nth_tl(||v||;ys)
>
∈ (B × (A List))))
9. ys : A List
10. (||v|| + 1) ≤ ||ys||
11. rec-case(v) of
[] => <init, ys>
x::xs' =>
p.let a,ys = p
in let h,t = ys
in <F[x;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v);firstn(||v||;ys))
with starting value:
init)
, nth_tl(||v||;ys)
>
∈ (B × (A List))
⊢ let a,ys = rec-case(v) of
[] => <init, ys>
h@0::t =>
r.let a,ys = r
in let h,t = ys
in <F[h@0;h;a], t>
in let h,t = ys
in <F[u;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v) @ [u];firstn(||v|| + 1;ys))
with starting value:
init)
, nth_tl(||v|| + 1;ys)
>
∈ (B × (A List))
BY
{ (RecUnfold `nth_tl` 0 THEN OldAutoSplit THEN Auto') }
1
1. A : Type
2. B : Type
3. init : B
4. F : A ⟶ A ⟶ B ⟶ B
5. xs : A List
6. u : A
7. v : A List
8. ∀ys:A List
((||v|| ≤ ||ys||)
⇒ (rec-case(v) of
[] => <init, ys>
x::xs' =>
p.let a,ys = p
in let h,t = ys
in <F[x;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v);firstn(||v||;ys))
with starting value:
init)
, nth_tl(||v||;ys)
>
∈ (B × (A List))))
9. ys : A List
10. (||v|| + 1) ≤ ||ys||
11. rec-case(v) of
[] => <init, ys>
x::xs' =>
p.let a,ys = p
in let h,t = ys
in <F[x;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v);firstn(||v||;ys))
with starting value:
init)
, nth_tl(||v||;ys)
>
∈ (B × (A List))
12. 0 < ||v|| + 1
⊢ let a,ys = rec-case(v) of
[] => <init, ys>
h@0::t =>
r.let a,ys = r
in let h,t = ys
in <F[h@0;h;a], t>
in let h,t = ys
in <F[u;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v) @ [u];firstn(||v|| + 1;ys))
with starting value:
init)
, nth_tl((||v|| + 1) - 1;tl(ys))
>
∈ (B × (A List))
Latex:
Latex:
1. A : Type
2. B : Type
3. init : B
4. F : A {}\mrightarrow{} A {}\mrightarrow{} B {}\mrightarrow{} B
5. xs : A List
6. u : A
7. v : A List
8. \mforall{}ys:A List
((||v|| \mleq{} ||ys||)
{}\mRightarrow{} (rec-case(v) of
[] => <init, ys>
x::xs' =>
p.let a,ys = p
in let h,t = ys
in <F[x;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v);firstn(||v||;ys))
with starting value:
init)
, nth\_tl(||v||;ys)
>))
9. ys : A List
10. (||v|| + 1) \mleq{} ||ys||
11. rec-case(v) of
[] => <init, ys>
x::xs' =>
p.let a,ys = p
in let h,t = ys
in <F[x;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v);firstn(||v||;ys))
with starting value:
init)
, nth\_tl(||v||;ys)
>
\mvdash{} let a,ys = rec-case(v) of
[] => <init, ys>
h@0::t =>
r.let a,ys = r
in let h,t = ys
in <F[h@0;h;a], t>
in let h,t = ys
in <F[u;h;a], t>
= <accumulate (with value a and list item p):
let x,x' = p
in F[x;x';a]
over list:
zip(rev(v) @ [u];firstn(||v|| + 1;ys))
with starting value:
init)
, nth\_tl(||v|| + 1;ys)
>
By
Latex:
(RecUnfold `nth\_tl` 0 THEN OldAutoSplit THEN Auto')
Home
Index