How to use structural induction on lists? I don't really understand structural induction and how to

pokoljitef2

pokoljitef2

Answered question

2022-06-14

How to use structural induction on lists?
I don't really understand structural induction and how to use it. The question is use structural induction on lists to prove that rev ( rev ( L ) ) = L. You may use the lemma that rev ( app ( L , M ) ) = app ( rev ( M ) , rev ( L ) ) ..
So far I believe the base cases are:
L = [ ]
But after that I am little confused as to how to go through the proof. Any help would be appreciated!

Answer & Explanation

Lilliana Burton

Lilliana Burton

Beginner2022-06-15Added 19 answers

Step 1
Formally, structural induction for lists L L ( X ) over a set X looks something like this:
P ( [ ] ) x X , l L ( X ) ( P ( l ) P ( x :: l ) ) L L ( X ) : P ( L ) where P is any predicate on L ( X ).
Step 2
Translated to English this induction principle tells us that in order to prove L L ( X ) , P ( L ) i.e. that "every list in L ( X ) had the property P", we need to show two things:
- P ( [ ] ), meaning the emply list has the property.
- If any list l L ( X ) and element x X, we need to verify that if l has the property P then the extended list x :: l also has the property P.
In your particular case, you are asked to use this for P ( L ) : rev ( rev ( L ) ) = L.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?