Hi everyone,
I am trying to use Turing.jl to solve an inference problem in quantum error correction. Here is a simple problem.
Problem Statement:
Consider a parity check bit c \in \{0,1\} computed from four binary variables x_1, x_2, x_3, x_4 \in \{0,1\} as follows:
where \oplus denotes the XOR operation. Equivalently, c represents the parity (even or odd) of the sum x_1 + x_2 + x_3 + x_4.
Each bit x_i is an independent Bernoulli random variable with success probability p_i, i.e.,
Given the observed parity c = 1:
- Determine the most probable configuration of (x_1, x_2, x_3, x_4).
- Find the most probable value of parity of a partial sum x_1 + x_2.
This is the decoding problem, which refers to the task of identifying the most likely error affecting a quantum state based on the observed error syndrome. The goal is to reverse the inferred error to recover the original logical state. Current approaches to solving this problem include belief propagation, integer programming, perfect matching, tensor networks, and other methods.
Here is my attempt.
using Turing
@model function one_check(y)
p1 ~ Bernoulli(0.15)
p2 ~ Bernoulli(0.05)
p3 ~ Bernoulli(0.05)
p4 ~ Bernoulli(0.05)
for i in eachindex(y)
y[i] = p1 ⊻ p2 ⊻ p3 ⊻ p4
end
end;
model = one_check([true])
map_estimate = maximum_a_posteriori(model)
mle_estimate = maximum_likelihood(model)
There are errors on the last two function, like
InexactError: Bool(NaN)
I don’t know how to solve this problem properly with Turing.jl.
Thanks!