I want to model the following Rust code, but in Isabelle:
trait Ballot<A> {
  fn on_options(&self) -> Set<A>;
  fn prefers(&self, a: A, b: A) -> bool;
  // assumes reflexivity, etc
}
struct Profile<A, T: Ballot<A>> {
  ballots: List<T>,
}
I tried to do it with typeclasses, but I think I'm on the wrong path:
class ballot =
  fixes on_options :: "'a set"
  fixes prefers :: "'a ⇒ 'a ⇒ bool"
  assumes (* ... *)
Help?
It depends what you are trying to achieve:
Yeah it's intended for a conrete problem, not an arbitrary Rust program. Thank you!
Last updated: Oct 31 2025 at 12:44 UTC