Statement
A statement is a logical expression that contains one or more variables and that can be either true or false. A statement is abstract in the sense that the statement alone do not have any value, but specify a set of logic rules that can be used to determine if the statement is true or false for given values of the variables.
Statement can often be expressed in natural language, for example "Over 18 years old" is a statement that contains the variable age
, and that is true if and only if age > 18
.
Formalisation
Jump to Implementation if you are only looking for the code.
Let consider a statement as a function defined on real variables:
We can assign the values for each variables of a statement as a vector , with the value of the -th variable. We note the set of all possible vectors possible, . So .
The logic rules are represented as a set of logical propositions. Each rule can involves any variables (atleast one), and can only be expressed using logical operators (, , ) and/or comparison operators (, , , , ).
The function can be defined as the following:
Example:
A statement is analogous to a predicate in logic.
Some observations:
- If there is two rules that are mutually exclusive, then cannot be true for any .
- If there's a variable that is not used in any rule, then is equivalent to the statement that does not contain but has the same set of rules.
Zero-knowledge statement
We can divide the set as the union of two distinct sets: and , such that and .
We redefine the statement function as the prover that returns a new proof :
, with the set of all possible proofs of the statement .
We say that is an Attestation proof.
Example: We can rewrite the previous statement as