The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Copyright 2014 Jeffrey Kegler
This document is licensed under
a Creative Commons Attribution-NoDerivs 3.0 United States License.

The first three numbers in A052952 are defined as 1, 1, and 3. Hand
counts will establish that they match W(1), W(2) and W(3).

Length 1, Parse 0, value==(6-1)==5
Length 2, Parse 0, value==(6-(-1))==7
Length 3, Parse 0, value==((6--)-1)==5
Length 3, Parse 1, value==(6-(--1))==6
Length 3, Parse 2, value==(6-(-(-1)))==5

It remains to show that W(n) = A052952(n) for n>2.

Look at the far right hand side of the sequence of minus signs.
It's one of three things: a binary minus (subtraction), a unary
minus (negation) or the second character of a pre-decrement. We can
get a count of each of these three categories and add them to produce
W(n).

The unary minus category can be formed from any of the parses with
one less minus sign, by adding a negation to the right side. So
there are W(n-1) parses from that source.

Similarly the binary minus category is all the parses with two fewer
minus signs, with a pre-decrement added to the far right end.
Therefore, W(n-2) parses from that source.

The subtraction category is only slightly harder. The only operator
pattern allowed to the left of the binary subtraction is a series
of post-decrements. So if n-1 is even, there is one parse from that
source. If n-1 is odd, the pattern of post-decrements cannot be
formed, and there are no parses from that source. In Perlish notation,
the number of parses is (n-1) % 2 ? 0 : 1.

Putting all the sources of parses together, we get

W(n) = W(n-1) + W(n-2) + ((n-1) % 2 ? 0 : 1)

We can use this formula to derive a count for one of its own
components, W(n-1):

W(n-1) = W(n-2) + W(n-3) + ((n-2) % 2 ? 0 : 1)

And then we can substitute in the first formula from the second:

W(n) = W(n-2) + W(n-3) + ((n-2) % 2 ? 0 : 1)  + W(n-2) + ((n-1) %
2 ? 0 : 1)

Simplifying:

W(n) = 2*W(n-2) + W(n-3) + ((n-2) % 2 ? 0 : 1)  + ((n-1) % 2 ? 0 :
1)

Finally, note that of two consecutive numbers one will always be
odd and the other always even. Therefore ((n-2) % 2 ? 0 : 1)  +
((n-1) % 2 ? 0 : 1) will always be 1. Applying the final simplification:

W(n) = 2*W(n-2) + W(n-3) + 1

From http://www.research.att.com/~njas/sequences/A052952, the
recurrence for A052952 is a(n) = 2*a(n-2) + a(n-3) + 1. Exactly the
same as the recurrence I've just proved for the Wall series. QED.