1
$\begingroup$

Is the concatenation operation on a list associative?

[] = empty list
l and l' = lists

Let's assume that we have to prove that:

l concat (l' concat []) = (l concat l') concat []

How can I prove it using a prof by induction?

I was thinking that:
base case is: [] concat l' = l'
Step case is = (s:l) concat l' = l'

I am not sure if what I wrote is correct and if the base and step cases are correct.

Thank you

  • 0
    Do you mean l' is a list?2017-02-04
  • 0
    I've modified the formatting a bit. Please let me know if it doesn't fit your intended meaning.2017-02-04
  • 0
    yes l' ( l prime) is a list2017-02-04
  • 0
    By using the same letter the symbol `l'` suggest some correlation to `l`. Wouldn't is be more clear if you name your lists with different letters, say, `l` and `k`?2017-02-04
  • 0
    @CiaPan yes you are right, and then how can I go on?2017-02-06

1 Answers 1

-2

The easiest way to prove that concatenation is associative is using indices: prove that if $a,b,c$ are lists and $i$ is an index, then $$((a\ \mathrm{concat}\ b)\ \mathrm {concat}\ c)[i]=(a\ \mathrm{concat}\ (b\ \mathrm {concat}\ c))[i]$$ Proving it this way does not require induction.

  • 0
    Um, why the downvote?2017-02-04
  • 0
    I didn't downvote, but I don't find this answer useful either. What your post amounts to saying is "prove that the concatenation product is associative". I don't see a method and I don't see how to prove the statement without induction.2017-02-05