Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Mutual induction with list

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Mutual induction with list


Chronological Thread 
  • From: Frédéric Besson <frederic.besson AT inria.fr>
  • To: Coq Club <coq-club AT inria.fr>
  • Cc: S3 <scubed2 AT gmail.com>
  • Subject: Re: [Coq-Club] Mutual induction with list
  • Date: Mon, 21 May 2012 10:00:04 +0200


On 20 mai 2012, at 12:55, Adam Chlipala wrote:

> S3 wrote:
>> How do you have induction over a data structure
>> that contains a list?
>
> This is a genuine Frequently Asked Question, and it's addressed in Section
> 3.8 of CPDT:
> http://adam.chlipala.net/cpdt/

For those not comfortable with writing directly proof principles,
another solution is to write a depth function and
do proofs by strong induction over the depth of the tree (Wf_nat.lt_wf_ind).

Fixpoint depth (t:BlueTree) : nat :=
match t with
| BlueLeaf | RedLeaf => O
| Branch l => S (List.fold_right (fun x y => max (depth x) y) O l)
end.

--
Frédéric




Archive powered by MHonArc 2.6.18.

Top of Page