ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
Counting.h File Reference

Counting semiring (ℕ, +, ×, 0, 1). More...

#include <numeric>
#include <vector>
#include <stdexcept>
#include "Semiring.h"
Include dependency graph for Counting.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  semiring::Counting
 The counting semiring over unsigned. More...
 

Namespaces

namespace  semiring
 

Detailed Description

Counting semiring (ℕ, +, ×, 0, 1).

The counting semiring ( \(\mathbb{N}\), \(+\), \(\times\), 0, 1) counts the number of distinct derivations (proof witnesses) of each query result tuple.

Operations:

  • zero() → 0
  • one() → 1
  • plus() → sum of all operands
  • times() → product of all operands
  • monus() → truncated subtraction: max(0, x − y)
  • delta() → 1 if x ≠ 0, else 0

This semiring is not absorptive.

Definition in file Counting.h.