简体   繁体   中英

Is there a notion of strong induction in Welder?

While working with Welder I faced the situtation where I have to proof that:

if content(l1) == content(l2) and f is an idempotent, associative and commutative operator then fold(f,z,l1) = fold(f,z,l2)

At one stage of my proof I wanted to show that for a list l1 of the form x::xs:

fold(f,z,without(x,xs)) == fold(f,z,without(x,l2))

Where without(x,.) removes the occurrences of x from the list. Therefore it is clear that the size of without(x,xs) is less than the size of x::xs and so if strong induction was allowed in Welder I should be getting the equality (contents are equal).

Currently, the system just tells me there is no induction hypotheses for without(x,xs). So how do you do strong induction on Welder?

The well-founded ordering that underlies structural induction doesn't correspond to an ordering on the sizes of the trees but to a sub-tree relation. Namely, xs < Cons(x, xs) , but xs and Cons(x, ys) are not comparable if xs is not a sub-element of ys (even when xs.size <= ys.size ). This is why you can't assume the inductive hypothesis on without(x,xs) since this isn't guaranteed to be a sub-tree of x :: xs .

Welder actually does allow strong induction. For example, the inductive hypothesis is defined on xs.tail , xs.tail.tail , etc. If you want an induction based on sizes, you'll have to use naturalInduction (which is also strong).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM