Thm* p q
Thm*
Thm* (z:{1...}, s:({1...z}{1...n}Peg).
Thm* (s is a Hanoi(n disk) seq on 1..z & s(1) = (i.p) & s(z) = (i.q))
This proof is a variant of
Thm* n:, p,q:Peg.
Thm* p q
Thm*
Thm* (a:.
Thm* (z:{a...}, s:({a...z}{1...n}Peg).
Thm* (s is a Hanoi(n disk) seq on a..z & s(a) = (i.p) & s(z) = (i.q))
not only in its fixing the starting index at 1, but also in its use of index shifting and peg permutation to reduce the recursion. The base case (no disks) is the essentially the same, and the construction of the result from shorter Hanoi sequences for one few disks via the
What's different is how
Thm* n:, a,z:, s:({a...z}{1...n}Peg).
Thm* s is a Hanoi(n disk) seq on a..z
Thm*
Thm* (f:(PegPeg).
Thm* (Inj(Peg; Peg; f) (x,i. f(s(x,i))) is a Hanoi(n disk) seq on a..z)
to
Thm* p,r,q,s:Peg. p q r s Inj(Peg; Peg; permute(p to r ; q to s))
giving us
(x,i. permute(p to otherPeg(p; q) ; otherPeg(p; q) to q)(s1(x,i)))
is a Hanoi(n-1 disk) seq on 1..m
then shift the indexing by
Thm* n:, a,z,d:, s:({a...z}{1...n}Peg).
Thm* s is a Hanoi(n disk) seq on a..z
Thm*
Thm* (x.s(x-d)) is a Hanoi(n disk) seq on a+d..z+d
to get
(x,i. permute(p to otherPeg(p; q) ; otherPeg(p; q) to q)(s1(x-m,i)))
is a Hanoi(n-1 disk) seq on 1+m..m+m
These sequences can then be joined in the same way as in the original proof by using the lemma
Thm* n:, a:, z:{a...}, m:{a...z-1}, f,g:({1...n}Peg).
Thm* f(n) g(n)
Thm*
Thm* (s1:({a...m}{1...n-1}Peg), s2:({m+1...z}{1...n-1}Peg).
Thm* (s1 is a Hanoi(n-1 disk) seq on a..m
Thm* (& s1(a) = f {1...n-1}Peg
Thm* (& s2 is a Hanoi(n-1 disk) seq on m+1..z
Thm* (& s2(z) = g {1...n-1}Peg
Thm* (& s1(m) = s2(m+1)
Thm* (& (i:{1...n-1}. s1(m,i) f(n) & s2(m+1,i) g(n)))
Thm*
Thm* (r1:({a...m}{1...n}Peg), r2:({m+1...z}{1...n}Peg).
Thm* ((r1 @(m) r2) is a Hanoi(n disk) seq on a..z & r1(a) = f & r2(z) = g)
QED
About: