I would like to proof some properties of sets on Inox/Welder but I'm lacking examples that help me to figure out how to do so. Say I want to proof:
content(y::xs).contains(x) && x != y ==> content(xs).contains(x)
I define the property:
def property(xs: Expr) =
forall("x"::A,"y"::A){case (x,y)
content(ConsA(y,xs)).contains(x) && x !== y ==> content(xs).contains(x)
}
But it turns out that this property will not compile because it is not well formulated (apparently the wrong parts are .contains, &&, !==...)
So, what is the right way to formulate the property?. Here I'm assuming I have a content function defined as:
val contentFunction = mkFunDef(contentID)("A") { case Seq(aT) => (
Seq("l" :: T(list)(aT)), SetType(aT), { case Seq(l) =>
if_ (l.isInstOf(T(cons)(aT))) {
SetAdd(E(contentID)(aT)(l.asInstOf(T(cons)(aT)).getField(tail)), l.asInstOf(T(cons)(aT)).getField(head))
} else_ {
FiniteSet(Seq.empty, aT)
}
})
}
Regarding the proof part imagine I'm given the function:
def without(x: A, xs: List[A]) = xs match{
case Nil() => Nil()
case y :: ys if(x == y) => without(x,ys)
case y :: ys if(x != y) => y :: without(x,ys)
}
that should remove x from list xs and say I want to proof that
content(without(x,l)) == content(l) -- Set(x)
Can you give a sketch of how to do it? Should I be using the BuiltInNames such as SetDifference?