Proof by Induction of String exponentiation? (Algorithms)

In summary: And yes, you can do that.Hope this helps.In summary, the conversation discusses the use of induction to prove that for any given string α in an Alphabet T, the length of the string αn is equal to n times the length of α. This can be proven using induction on the variable n, as well as the proposition that the length of concatenated strings is equal to the sum of their individual lengths. The conversation also includes a step-by-step explanation of the base case and inductive step for the proof.
  • #1
Enharmonics
29
2

Homework Statement


gK3OG6l.png

Wherein α is a string, λ = ∅ = the empty string, and T* is the set of all strings in the Alphabet T.

Homework Equations



(exp-Recursive-Clause 1) : α0 = λ
(exp-Recursive-Clause 2) : αn+1 = (αn) ⋅ α

The Attempt at a Solution


[/B]
This one is proving difficult for me. I remember my professor mentioning during lecture that usually when you're asked to prove something involving strings, the way to do it is by induction on the length of the string, and given the fact that we're being asked to prove that

(∀n ∈ ℕ)(∀α ∈ T*)(|αn| = n|α|)

the (|αn| = n|α|) bit tells me that induction on the length of α is involved, but I don't see how. Just out of curiosity, I tried it the way I usually do it:

PROOF of (∀n ∈ ℕ)(∀α ∈ T*)(|αn| = n|α|) BY INDUCTION on |α|

BASE CASE: Suppose |α| = 0. Then α = λ and

RHS = n|α| = n(0) = 0 ≠ LHS

Which isn't right. If I start on the LHS, I've got

LHS = |αn| =

And that's as far as I got, since I don't know what I can do with |αn| knowing only that |α| = 0.

Am I maybe supposed to be doing induction on n instead of |α|? Or is there something else I'm missing?
 

Attachments

  • gK3OG6l.png
    gK3OG6l.png
    5.5 KB · Views: 669
Physics news on Phys.org
  • #2
Let ##\alpha## be however long, it doesn't matter. Use induction on n.
 
  • #3
verty said:
Let ##\alpha## be however long, it doesn't matter. Use induction on n.

After a few hours of trying, I managed to make it through the synthetic method using induction on n and another proposition (I'll call it "Length of Concatenated Strings", that was proven in class:

PROPOSITION 1: LENGTH OF CONCATENATED STRINGS
∀α, β |α ⋅ β| = |α| + |β|

So here's the base case:

BASE CASE: Suppose n = 0, α is an arbitrary string. Then

LHS = |αn| = |α0| = |λ| = 0 = 0|α| = n|α| = RHS

I'll pause here to note that I'm not confident this is right; in fact, I suspect it's wrong. This particular sequence of steps where I go from
the length of the empty string |λ| (which is 0 by definition) to n|α|:

|λ| = 0 = 0|α| = n|α|

Is one I didn't really "believe" while I was writing (but I kept going because I wanted to at least feel like I was making some progress). My reasoning is that 0 = 0|α|, since the length of a string |α| ε ℕ and therefore 0|α| = 0 due to the multiplication property of 0. Then, since I established in the premise of the base case that n = 0, I substitute 0|α| = n|α| to "complete" the proof.

I don't know how to explain it, but this seems "finicky" to me. I don't feel that I did it "right". Still, I continued to the inductive step, again just wanting to feel like I was making some headway:

INDUCTION HYPOTHESIS: If n = k, then |αn| = n|α|

INDUCTION STEP: Suppose n = k + 1. THEN

LHS = |αn| = |αk + 1| = |(αk) ⋅ α| = |k|a| ⋅ a| = k|α| + |α| = (k+1)|a| = n|a| = RHS

Again, I don't "feel" that this many of these steps are right. In particular:

|k|α| ⋅ α| = k|α| + |α|

Based on PROPOSITION 1, |k|α| ⋅ α| actually yields |k|α|| + |α|, but I reasoned that

|k|α|| + |α| = k|α| + |α|

Since k ε ℕ and |α| ε ℕ (definition of the length of a string). That is, | k * |α| | should be the same thing as just k * |α|, since neither k nor |α| are strings and length is a property of strings, so the extra | | are superfluous.

This:

k|α| + |α| = (k+1)|α|

is based on the definition of multiplication, i.e. n * k = k0 + k1 + ... + kn. I don't know if I can use it here, though.

Finally, this:

(k+1)|α| = n|α|

This is the iffiest step of all. It's based on the fact that I let n = k + 1 at the beginning of the inductive step, but I'm not sure that I can actually use that anymore once I've already transformed that k + 1 into a k in the step

k + 1| = |(αk) ⋅ α|

Anyhow, that's what I've got so far. Apologies if my questions seem stupid. This is my first time practicing induction in a very long time. I'd appreciate it if you (or anyone else) could let me know if I'm on the right track with this answer, or point me in the right direction if I'm not.
 
  • #4
One thing I see is I didn't see this step: ##|\alpha^k \cdot \alpha| = |\alpha^k| + |\alpha|##. What you did instead was not correct.
 
  • Like
Likes Enharmonics
  • #5
verty said:
One thing I see is I didn't see this step: ##|\alpha^k \cdot \alpha| = |\alpha^k| + |\alpha|##. What you did instead was not correct.

Thanks! I must've mixed up the order of the steps while desperately trying to figure this out yesterday.

I've revised my inductive step to reflect that fact. Here's the new version:

LHS = |αn| = |αk + 1| = |(αk) ⋅ α| = |αk| + |α| = k|α| + |α| = (k+1)|α| = n|α| = RHS

Is this better? Also, is writing

k|α| + |α| = (k+1)|α| = n|α|

Based on the fact that I set n = k + 1 at the beginning of the inductive step correct after all?
 
  • #6
It looks good to me. Well done.
 
  • Like
Likes Enharmonics

1. How does proof by induction work for string exponentiation algorithms?

Proof by induction is a mathematical technique used to prove that a statement is true for all natural numbers. In the context of string exponentiation algorithms, it involves proving that the algorithm works for the base case (usually the empty string) and then showing that if it works for a certain input, it will also work for the next input.

2. What is the importance of using proof by induction in string exponentiation algorithms?

Proof by induction is important because it provides a rigorous and systematic way to prove the correctness of an algorithm. It allows us to prove that an algorithm works for all possible inputs, not just a few specific cases.

3. Can you provide an example of a string exponentiation algorithm and its proof by induction?

One example of a string exponentiation algorithm is the function that takes a string and an integer and returns the string repeated the given number of times. The proof by induction for this algorithm would involve showing that the base case, when the exponent is equal to 0, returns an empty string. Then, assuming that the algorithm works for an input string and exponent, we can show that it also works for the next input by concatenating the string with itself one more time.

4. Are there any limitations or drawbacks to using proof by induction in string exponentiation algorithms?

One limitation of proof by induction is that it can only be used for proving statements that are true for all natural numbers. This means that it may not be applicable to more complex algorithms or problems that involve real numbers or other types of inputs.

5. How can we ensure that the proof by induction for a string exponentiation algorithm is correct?

To ensure the correctness of a proof by induction for a string exponentiation algorithm, we must carefully follow the steps of the proof and make sure that each case is logically sound. It is also important to double-check the base case and the induction step to make sure they are both correct and cover all possible inputs.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
913
  • Calculus and Beyond Homework Help
Replies
7
Views
417
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
14
Views
4K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
9
Views
1K
Replies
13
Views
1K
  • Math Proof Training and Practice
Replies
8
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
7
Views
1K
Back
Top