Zulip Chat Archive

Stream: new members

Topic: Summing over a `Prop`


Snir Broshi (Dec 12 2025 at 07:06):

import Mathlib

theorem foo1 :  n  5, n = 15 := rfl
theorem foo2 :  (n : Fin 10),  (_ : n  5), n = 15 := rfl
theorem foo3 : ∑' (n : ) (_ : n  5), n = 15 := rfl
theorem foo4 : ∑' (n : ), ∑' (_ : n  5), n = 15 := rfl

The first one works because it constructs a Finset first so it doesn't sum over proofs of n ≤ 5, but how can I make the rest work? Basically, why do docs#Finset.sum / docs#Finset.univ / docs#Multiset.sum / docs#tsum take in a Type* rather than a Sort*? The docstring of docs#PSigma warns of "universe level constraints", but it doesn't explain further.

Ruben Van de Velde (Dec 12 2025 at 07:46):

Let's take a step back. Summing over all n <= 5 makes sense, but why would you implement that as summing over a Prop?

Eric Wieser (Dec 12 2025 at 08:32):

I think this is a pretty reasonable request, given we do what Snir is asking already for lattice operations

Eric Wieser (Dec 12 2025 at 08:32):

Ultimately the things you list take in Type* not Sort* because they build upon docs#List, which does the same

Robin Arnez (Dec 12 2025 at 16:31):

You can use PLift thanks to docs#PLift.fintypeProp:

import Mathlib

theorem foo1 :  n  5, n = 15 := rfl
theorem foo2 :  (n : Fin 10),  (_ : PLift (n  5)), n = 15 := rfl
theorem foo3 : ∑' (n : ) (_ : PLift (n  5)), n = 15 := by sorry -- not rfl though
theorem foo4 : ∑' (n : ), ∑' (_ : PLift (n  5)), n = 15 := by sorry -- not rfl though

Last updated: Dec 20 2025 at 21:32 UTC