libdpf/doc/pages/comparisons.md
2026-09-26 23:51:06 -06:00

26 lines
1.1 KiB
Markdown

# Comparisons & ranges {#comparisons}
A distributed comparison function returns a payload when a predicate holds
on the secret point. Shares are additive: `reconstruct` adds them.
| Call | When it is hot |
| --- | --- |
| `dpf::lt` / `leq` / `gt` / `geq` | The public query is on that side of the secret point |
| `dpf::eq` | The public query equals the secret point |
| `dpf::ic` | The secret point lies in a public interval |
| `dpf::idcf` / `cmp_prefix<L>` | A correction at every depth, or only the first `L` bits |
| `dpf::block_width<B>` | Ring words only at checkpoints `B` levels apart |
```cpp
auto [k0, k1] = dpf::make_dpf(std::uint8_t{40}, dpf::gt(std::uint64_t{1}));
auto opened = dpf::reconstruct(
dpf::eval_point(dpf::cmp, k0, std::uint8_t{50}),
dpf::eval_point(dpf::cmp, k1, std::uint8_t{50}));
// opened == 1
```
A wildcard comparison payload is filled later with `assign_cmp`.
Eval before that throws.
**Go deeper:** [dcf.hpp](@ref dpf/dcf.hpp), [interval.hpp](@ref dpf/interval.hpp),
[blocked_dcf.hpp](@ref dpf/blocked_dcf.hpp), [F_DCF](@ref dcf.hpp).