TITLE: How do we express measurable spaces using type theory?
QUESTION [18 upvotes]: A measurable space $(X,\mathcal X)$ consists of a set $X$ equipped with a $\sigma$-algebra of subsets $\mathcal X$. I would like to write computer programs involving measurable spaces, but to the best of my knowledge, no language (including Haskell) has the ability to deal with completely unstructured sets. On the other hand, type theory is an alternate foundation for mathematics which is well-grounded computationally. 
Given a measurable space $(X,\mathcal X)$, is there an equivalent presentation using Martin-Löf dependent type theory?
With no constraints on the measurable space, the answer is probably no; a counterexample would be appreciated. What if $\mathcal X$ is a countably generated $\sigma$-algebra?

REPLY [9 votes]: I am not exactly sure what you are looking for.
There is this work in inductively generated sigma-algebras in type theory:
   http://link.springer.com/article/10.1007%2Fs001530100123
More generally, I would be inclined to an algebraic approach to measure theory. 
For instance, using Riesz spaces (of real valued measurable functions modulo zero measure) 
http://logicandanalysis.org/index.php/jla/article/view/14/12
or the related pointfree (localic) approach
http://www.cs.bham.ac.uk/~sjv/Riesz.pdf
http://homepages.inf.ed.ac.uk/als/Research/Sources/mrs.pdf
There is also these formalizations in type  theory:
https://www.lri.fr/~paulin/ALEA/ (randomized algorithms)
http://www.cs.unibo.it/~sacerdot/PAPERS/jfr.pdf (Lebesgue’s Dominated Convergence Theorem in Matita).
I'd be happy to elaborate, but would need some more information about what you are searching about.