The Personnel example, with probabilities
Lax392996.ProbabilityExample · concepts/Lax392996/ProbabilityExample.lean · lax-392996
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Example
The paper's Example 14: each tuple of the -instance is kept with an independent probability, and (the others, unspecified in the paper, are here), and the probability that Nairobi is in the answer of is . Variables are numbered from 0 here, from 1 in the paper.
Concept map
Evidence
Each proof establishes this claim relative to its assumptions.
In the paper
- page 6 of this submission's paper
Lean source view on GitHub
| 1 | import Mathlib.Data.Rat.Defs |
| 2 | import Mathlib.Tactic.NormNum |
| 3 | import Lax392996.BooleanFunctions |
| 4 | import Lax392996.Databases |
| 5 | import Lax392996.AnnotatedDatabases |
| 6 | import Lax392996.RelationalAlgebra |
| 7 | import Lax392996.ProbabilisticDatabases |
| 8 | import Lax392996.PersonnelExample |
| 9 | import Lax392996.ProvenanceExample |
| 10 | |
| 11 | /-! |
| 12 | --- |
| 13 | title: The Personnel example, with probabilities |
| 14 | type: example |
| 15 | --- |
| 16 | The paper's Example 14: each tuple of the -instance |
| 17 | is kept with an independent probability, and |
| 18 | (the others, unspecified in the paper, are here), |
| 19 | and the probability that Nairobi is in the answer of is |
| 20 | . Variables are numbered from 0 |
| 21 | here, from 1 in the paper. |
| 22 | -/ |
| 23 | |
| 24 | namespace Lax392996.ProbabilityExample |
| 25 | |
| 26 | open Lax392996.BooleanFunctions Lax392996.Databases Lax392996.AnnotatedDatabases |
| 27 | open Lax392996.RelationalAlgebra Lax392996.ProbabilisticDatabases |
| 28 | open Lax392996.PersonnelExample Lax392996.ProvenanceExample |
| 29 | |
| 30 | /-- The probabilities of the tuples: `0.5`, except `0.7` for the second one. -/ |
| 31 | def P : ProbAssignment (Fin 7) where |
| 32 | prob x := if x = 1 then 7/10 else 1/2 |
| 33 | prob_nonneg := by |
| 34 | intro x |
| 35 | split <;> norm_num |
| 36 | prob_le_one := by |
| 37 | intro x |
| 38 | split <;> norm_num |
| 39 | |
| 40 | /-- Example 14: the probability that Nairobi is an answer is `0.35`. -/ |
| 41 | axiom nairobi_probability : |
| 42 | ProbAssignment.marginalProb P qcity instanceB !["Nairobi"] = 7/20 |
| 43 | |
| 44 | end Lax392996.ProbabilityExample |
| 45 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments