Zulip Chat Archive

Stream: mathlib4

Topic: Discrete rational probabilistic distribution to multiset


Martin Dvořák (Feb 23 2024 at 14:03):

Do we have a conversion of discrete rational probabilistic distributions to multisets?

import Mathlib.Algebra.BigOperators.Basic
import Mathlib.Data.Rat.Basic
open scoped BigOperators

def distributionToMultiset {D : Type} [Nonempty D] [Fintype D] [DecidableEq D]
    {x : D  } (x_is_distribution : 0  x   i, x i = 1) : Multiset D :=
  sorry

Martin Dvořák (Feb 26 2024 at 08:49):

Lemme break the problem into two parts. First, do we have a function for converting a list of rationals to a common denominator? Ideally, I would like something that transforms [1/3, 1/4, 1/4, 1/6] into [4, 3, 3, 2].

Ruben Van de Velde (Feb 26 2024 at 09:05):

field_simp must do something like that

Martin Dvořák (Feb 26 2024 at 09:15):

Do we have it as a function tho? I need a conversion function that comes with some Mathlib-friendly API.


Last updated: May 02 2025 at 03:31 UTC