# Certification of multi-qubit quantum systems with temporal inequalities

Gautam Sharma  Chellasamy Jebarathinam  Sk Sazim  Remigiusz Augusiak  Center
for Theoretical Physics, Polish Academy of Sciences, Aleja Lotników 32/46,
02-668 Warsaw, Poland

###### Abstract

Demonstrating contextual correlations in quantum theory through the violation
of a non-contextuality inequality necessarily needs some “contexts" and thus
assumes some compatibility relations between the measurements. As a result,
any self-testing protocol based on the maximal violation of such inequality is
not free from such assumptions. In this work, we propose temporal inequalities
derived from non-contextuality inequalities for multi-qubit systems without
assuming any compatibility relations among the measurements. We demonstrate
that the new inequalities can be maximally violated via a sequential
measurement scenario. Moreover, using the maximal violation of these temporal
inequalities we are able to certify multi-qubit graph states and the
measurements.

##  I Introduction

Multi-qubit entangled quantum systems are a ubiquitous resource in a large
variety of quantum information processing tasks like quantum computation
Raussendorf and Briegel (2001); Kok  _et al._ (2007), quantum error correction
Shor (1995); Terhal (2015), quantum communications Borregaard  _et al._
(2020); Hilaire  _et al._ (2021), quantum simulations Lanyon  _et al._ (2010);
Ma  _et al._ (2011) and cryptographic protocols Gaertner  _et al._ (2007);
Epping  _et al._ (2017). It is desirable to make sure that the quantum systems
employed in these tasks perform as specified by the provider. There exist a
number of ways to do such verification of the devices (quantum systems). The
standard tomography-based methods used to certify quantum devices are
constrained by two key limitations: a) the substantial overhead of resources
required during the process, and b) their infeasibility when applied to larger
system sizes. Thew  _et al._ (2002); Kiesel  _et al._ (2005). Fortunately,
there exist alternate certification techniques, namely, self-testing, which
are not only feasible for larger system sizes but also require fewer
resources.

Self-testing of quantum states and measurements is a remarkable way of
certifying the quantum devices Mayers and Yao (2004), in terms of reducing the
required resources. A plethora of self-testing schemes have been introduced
using non-local correlations based on the maximal quantum violation of Bell-
type inequalities Šupić and Bowles (2020); Kaniewski (2016a); Baccari  _et
al._ (2020a); Panwar  _et al._ (2022). Although the self-testing schemes based
on Bell-type inequalities provide a device-independent characterization of
quantum systems, these are restricted by the fact that they require spatial
separation between the subsystems. Thus, there is a hidden assumption of using
compatible measurement devices as the spatially separated measurements are
compatible with each other.

Recently, various certification schemes based on Kochen-Specker contextuality
Kochen and Specker (1967) and temporal correlations Leggett and Garg (1985);
Budroni and Emary (2014); Brierley  _et al._ (2015) have also been proposed
for certifying quantum devices Bharti  _et al._ (2019a); Irfan  _et al._
(2020); Saha  _et al._ (2020); Maity  _et al._ (2021); Santos  _et al._
(2022). Demonstrating quantum contextuality and temporal correlations do not
require any spatial separation and can be observed by using sequential quantum
measurements on a single quantum system. Thus, we can get rid of the
limitation of spatial separation between subsystems. However, the
certification schemes based on the violation of non-contextuality inequalities
also assume certain compatibility relations between the measurement devices
Bharti  _et al._ (2019b); Irfan  _et al._ (2020); Saha  _et al._ (2020)
whereas the certification schemes using temporal inequalities assume
compatibility relations on measurements as well as a) the preparation device
always prepares a maximally mixed state and b) the measurement device always
returns the post-measurement state and does not have any memory Saha  _et al._
(2020); Das  _et al._ (2022). Recently, we propose a self-testing scheme for
two-qubit devices based on sequential correlations where we do not require the
assumptions of compatibility on the measurements Jebarathinam  _et al._
(2023).

In this work, we extend the certification scheme of Ref. Jebarathinam  _et
al._ (2023) to multi-qubit systems without assuming that the measurement
operators are commuting. Specifically, we extend our previous work Ref. Santos
_et al._ (2022), in which we introduced a family of temporal inequalities for
the certification of multi-qubit quantum systems. To these non-contextual
inequalities, by dropping the assumption of compatibility relations between
the measurement operators, we modify the non-contextuality inequality by using
sequential correlations such that the modified inequalities are also maximally
violated by the multi-qubit graph states. In the self-testing protocol, we are
able to certify the previously “assumed" compatibility relations between the
measurements from the maximal violation of the inequality. In what follows, we
are able to certify all the pairs of anti-commuting operators as well as the
multi-qubit graph states.

This paper is organized as follows. In Sec II, we give a brief description of
the contextuality scenario and its temporal extension, the graph states, and
the self-testing statement. Next, in Sec. III we introduce the modified non-
contextuality inequality for three-qubits and its further modification using
sequential correlations and then demonstrate self-testing of three-qubit graph
states. In Sec IV, we extend the same procedure for the $n$-qubit graph
states.

##  II Preliminaries

Imagine a sequential measurements scenario that enables us to study both
contextual and temporal correlations as we will describe later. In order to
perform sequential measurements we assume that these measurements do not
physically destroy the system. Let us consider a set of measurements
$\\{M_{i}\\}$ that are measured in a sequence on a physical system. The
possible measurement outcomes $m_{i}$ can take the values $\pm 1$. For a
sequence of $n$ measurements performed in the order $M_{1}\rightarrow
M_{2}\rightarrow\ldots\rightarrow M_{n}$, the sequential correlations are
defined as follows.

$\displaystyle\langle M_{1}\ldots M_{n}\rangle_{seq}=\sum_{m_{i}=\pm
1}m_{1}\ldots m_{n}p(m_{1},\cdots,m_{n}|\\{M_{i}\\}),$ (1)

where the $p(m_{1},\cdots,m_{n}|\\{M_{i}\\})$ is the joint probability
distribution of measurement outcomes for measurements performed in the
aforementioned order.

Since, we do not assume that the measurements performed in a sequence commute,
we cannot exploit the fact that the dimension of the underlying Hilbert space
is arbitrary to invoke the Naimark dilation technique to represent the
observed correlations obtained with arbitrary measurements (also POVM) in
terms of projective measurements. Therefore, we need to assume the
measurements $M_{i}$ to be projective. Also, from now on, slightly abusing the
notation, by $M_{i}$ we denote quantum observables representing those
measurements; their eigenvalues are $\pm 1$, so that $M_{i}^{2}=\mathbbm{1}$.

Let us now notice that the expectation values (1) for for the two
(noncummiting) measurements performed in a sequence $M_{1}\rightarrow M_{2}$,
expresses in terms of the Born’s rule as Majidy  _et al._ (2021); Pan  _et
al._ (2018)

$\displaystyle\langle M_{1}M_{2}\rangle_{seq}$
$\displaystyle:=\frac{1}{2}(\langle M_{1}M_{2}\rangle+\langle
M_{2}M_{1}\rangle)$
$\displaystyle=\frac{1}{2}\mbox{tr}\left(\rho\\{M_{1},M_{2}\\}\right),$

where $\\{A,B\\}=AB+BA$. Similarly, for three measurements $M_{1}\rightarrow
M_{2}\rightarrow M_{3}$, the third order sequential correlations take the
following form

$\displaystyle\langle M_{1}M_{2}M_{3}\rangle_{seq}$ $\displaystyle:=$
$\displaystyle\langle M_{1}M_{2}M_{3}\rangle+\langle M_{1}M_{3}M_{2}\rangle$
$\displaystyle+\langle M_{2}M_{3}M_{1}+\langle M_{3}M_{2}M_{1}\rangle$
$\displaystyle=$
$\displaystyle\frac{1}{4}\mbox{tr}\left(\rho\\{M_{1},\\{M_{2},M_{3}\\}\\}\right).$

Therefore, the sequential correlations for $n$ measurements, $\langle
M_{1}\ldots M_{n}\rangle_{seq}$, can exactly be expressed as below

$\displaystyle\frac{1}{2^{n-1}}\mbox{tr}\left(\rho\\{M_{1},\\{M_{2},\ldots,\\{M_{n-1},M_{n}\\}\\}\\}\right).$
(2)

For a complete analysis of $n$-th order sequential correlations, we refer our
enthusiastic reader to the appendix of Ref. Pan  _et al._ (2018).

###  II.1 Non-contextuality inequalities in sequential measurement scenario

Consider now, that the measurements $\\{M_{l}\\}$ are such that we know the
compatibility relations among them. This knowledge of compatibility relations
allows us to identify the contexts, where all the measurements belonging to a
“context" are compatible with each other. An experiment, that realizes the
sequential measurement of $n$ measurements $\\{M_{l}\\}$ belonging to a
“context", generates a joint probability distribution function that is
independent of the order in which the measurements are performed. Since the
joint probability distribution functions are now independent of the order, the
sequential correlation function reduces to the expected values as $\langle
M_{1}\ldots M_{n}\rangle_{seq}=\langle M_{1}\ldots M_{n}\rangle$.

These expectation values can then be used to construct a non-contextuality
inequality. The non-contextuality inequalities are defined as a linear
function of sequential correlations as following

$\displaystyle\mathcal{I}_{NC}=\sum c_{i,j,k,\cdots}\langle
M_{i}M_{j}M_{k}\ldots\rangle\leq\eta_{C}\leq\eta_{Q}$ (3)

where $c$’s are real coefficients, and $\eta_{C}$ and $\eta_{Q}$ are the
classical and quantum bounds. Whenever $\eta_{Q}>\eta_{C}$ is observed it
leads to the refutation of the non-contextuality assumption in quantum theory
Kochen and Specker (1967).

The classical bound $\eta_{C}$ is obtained if a non-contextual hidden variable
model can describe the joint probability distributions of the measurement
outcomes Kochen and Specker (1967). In a non-contextual model, the expectation
values can be factorized and each expectation value is deterministic, i.e.,
$\langle M_{1}\ldots M_{n}\rangle=\prod_{l}m_{l}$, with $m_{l}=\pm 1$. Whereas
the quantum bound $\eta_{Q}$ is obtained by maximizing over the set of all
quantum states and measurements in any Hilbert space, and we can write

$\displaystyle\eta_{Q}=\sup_{\\{M_{l}\\},\rho}\left[\sum
c_{i,j,k,\cdots}\mbox{tr}({\rho}\ M_{i}M_{j}M_{k}\ldots)\right],$

where $M_{l}$ are Hermitian operators acting on the Hilbert space
$\mathcal{H}$ with eigenvalues $\pm 1$ and $\rho=\ket{\psi}\bra{\psi}$. It has
been demonstrated that the maximal violation of the non-contextuality
inequalities can be used to certify multi-qubit entangled states and the
measurements Irfan  _et al._ (2020); Santos  _et al._ (2022). However, we
would like to get rid of the assumption of having information about the
compatibility of measurements. So we will prescribe a method to construct
temporal inequalities from the non-contextuality inequalities in the next
section.

###  II.2 Temporal inequalities in sequential measurement scenario

Let us now generalize the above findings to the case of the complete graph
state of any number of qubits. To this end, we will construct temporal
inequalities in the sequential measurement scenario by modifying the non-
contextuality inequalities in Eq. (3). To do so, we replace expectation value
terms of compatible measurements appearing in (3), with one or more sequential
correlations of $\\{M_{i}\\}$ such that there is at least one “expectation"
value term for all permutations of a sequence of the measurements. We explain
the methodology with a few examples below.

Generating all permutations of expectation values.– Let us consider the
simplest example consisting of two compatible measurements $M_{1},M_{2}$ and
we will make the following replacement with sequential correlation function of
$M_{1}\rightarrow M_{2}$

$\displaystyle\langle M_{1}M_{2}\rangle\rightarrow\langle
M_{1}M_{2}\rangle_{seq}=\frac{1}{2}(\braket{M_{1}M_{2}}+\braket{M_{2}M_{1}}),$

As there are only two possible permutations, we get both of them with one
sequential correlation. Next, we consider the expectation value of three
compatible measurements and replace it with a pair of sequential correlations
of the types $M_{1}\rightarrow M_{2}\rightarrow M_{3}$ and $M_{2}\rightarrow
M_{1}\rightarrow M_{3}$, i.e., we have

$\displaystyle\langle M_{1}M_{2}M_{3}\rangle_{\pi}=\frac{1}{2}\left(\langle
M_{1}M_{2}M_{3}\rangle_{seq}+\langle M_{2}M_{1}M_{3}\rangle_{seq}\right),$

where $\langle M_{1}M_{2}M_{3}\rangle_{\pi}$ contains sequential correlations
such that all possible permutations of expectation values are included at
least once. It can be readily checked that the $\langle
M_{1}M_{2}M_{3}\rangle_{\pi}$ contains all possible six permutations of
expectation values with $M_{1},M_{2},M_{3}$. The factor of $1/2$ is chosen so
that the maximum value of the $\langle M_{1}M_{2}M_{3}\rangle_{\pi}$ is one.
In general, we can do this for an arbitrary number of $n$ measurements which
will require us to replace expectation value terms by a set of sequential
correlations and divide the sum by the number of sequential correlations. A
minimum of $n!/2^{n-1}$ number of sequential correlations are required to
generate all permutations of expectation values. This is due to the fact that
there are $n!$ possible permutations and each sequential correlation gives
$2^{n-1}$ permutations of expectation values. Therefore, we construct a
temporal inequality from Eq. (3) as following

$\displaystyle\mathcal{I}_{T}=\sum c_{\\{M_{i}\\}}\braket{M_{1}\ldots
M_{n}}_{\pi}\leq\eta_{C}\leq\eta_{Q},$ (4)

where $\langle M_{1}\ldots M_{n}\rangle_{\pi}$ contains all possible
sequential correlations of $M_{1},\ldots,M_{n}$ such that all $n!$
permutations of expectation values appear at least once.

Now, we can derive the classical bound of (4) using any deterministic
strategy, which is due to the fact that similar to Bell-type and non-
contextuality scenarios, the temporal inequalities also rely on the assumption
of the existence of joint probability distribution for the measurement
outcomes Markiewicz  _et al._ (2014). Whereas the quantum bound can be
obtained by maximizing over the set of all pure quantum states and projective
measurements, as argued earlier.

###  II.3 Graph states

The goal of this work is to introduce a method of certification of multi-qubit
genuinely entangled GHZ states that are a particular instance of a larger
class of states called graph states, corresponding to complete graphs.

Before moving to our results let us define the graph states (see, e.g., Ref.
Hein  _et al._ (2006)). Consider a graph
$\mathcal{G}=(\mathcal{V},\mathcal{E})$ consisting of $n$ vertices from a set
$\mathcal{V}$ and a set of edges $\mathcal{E}$ that connect some pairs of
vertices; in particular, a graph is termed complete when for any pair of
vertices there exists an edge connecting them. Now, in order to associate an
$n$-qubit state to any connected graph we follow the stabilizer formalism
Gottesman (1996) and to each vertex $v_{i}\in\mathcal{V}$ we associate an
operator defined as

$G_{i}=X_{i}\otimes\bigotimes_{j\in\mathcal{N}(i)}Z_{j},$ (5)

where $X_{i}$ and $Z_{i}$ are the qubit Pauli operators. The operators $X_{i}$
act on the vertex $v_{i}$, while the operators $Z_{j}$ act on the vertices
$v_{j}\in\mathcal{N}_{i}$. In this way we arrive at the following definition.

######  Definition 1.

A graph state $|G\rangle$ associated with the graph
$\mathcal{G}=(\mathcal{V},\mathcal{E})$ is defined as the unique state
stabilized by the corresponding operators $G_{i}$ (5), that is,

$G_{i}|G\rangle=|G\rangle,\qquad\forall i=1,\dots,n.$ (6)

In other words, $\ket{G}$ is the unique common eigenvector of all stabilizers
$\\{G_{i}\\}$ with eigenvalue $+1$.

In this work, we consider the $n$-qubit graph states which are constructed
using a complete graph, i.e., the graphs in which all pairs of vertices are
connected with one another. The stabilizing operators for such connected
graphs have the following form

$G_{i}=Z_{1}\ldots Z_{i-1}X_{i}Z_{i+1}\ldots Z_{n},$ (7)

with $i=1,\ldots,n$. They stabilize an $n$-qubit graph state that is local-
unitary equivalent to the GHZ state $(1/\sqrt{2})(\ket{0}^{\otimes
n}+\ket{1}^{\otimes n})$. The simplest example of such a graph state is
associated with a complete three vertex graph (left of Fig. 1) state which is
stabilized by the following three stabilizing operators:

$\displaystyle G_{1}$ $\displaystyle=$ $\displaystyle X\otimes Z\otimes Z,$
$\displaystyle G_{2}$ $\displaystyle=$ $\displaystyle Z\otimes X\otimes Z,$
$\displaystyle G_{3}$ $\displaystyle=$ $\displaystyle Z\otimes Z\otimes X,$
(8)

and can be stated as

$\displaystyle|G_{3}\rangle$ $\displaystyle=$
$\displaystyle\frac{1}{\sqrt{8}}({\left|000\right\rangle}+{\left|100\right\rangle}+{\left|010\right\rangle}-{\left|110\right\rangle}$
(9) $\displaystyle\hskip
21.33955pt+{\left|001\right\rangle}-{\left|101\right\rangle}-{\left|011\right\rangle}-{\left|111\right\rangle}).$

The next simplest set of stabilizers of this form is associated with a
connected four vertex graph (on the right of Fig. 1) and in a similar way we
can construct further such $n$-qubit connected graph states.

Figure 1: Two simplest connected graphs with 3 and 4 vertices respectively.

###  II.4 Self-testing with temporal inequalities

In its original formulation put forward in Ref. Mayers and Yao (2004) (see
also Ref. Šupić and Bowles (2020)), self-testing aims to certify an unknown
quantum state and a set of measurements from the statistics obtained in an
experiment, up to certain equivalences such as local isometries and additional
of some extra degrees of freedom Mayers and Yao (2004). The self-testing based
on Bell inequality violations is by definition device-independent as it does
not, in general, require any assumption about the state and the measurements.
However, in the case of contextuality-based certification one has to make an
additional assumption that the measurements involved obey certain
compatibility relations Bharti  _et al._ (2019b), which in the case of Bell
scenario is automatically satisfied due to the spatial separation between
observers. In general it is dificult to certify in an experiment whether such
compatibility relations are obeyed by the measurements. There exist other
self-testing schemes based on the violation of non-contextual inequalities
which do not require making this assumption Saha  _et al._ (2020); Das  _et
al._ (2022).

Our aim here is to introduce the temporal-correlations version of the
contextuality-based certification schemes introduced recently in Ref. Santos
_et al._ (2022), which does not rely on any assumption about the compatility
of the involved measurements. To this aim, let us consider a temporal
inequality, say $\mathcal{I}_{T}$ constructed from a non-contextuality
inequality, $\mathcal{I}_{NC}$, i.e.,
$\mathcal{I}_{NC}\rightarrow\mathcal{I}_{T}$ using the techniques in II.2. We
have an experiment that realizes the sequential measurement scenario for
$\mathcal{I}_{T}$, such that both the state (in general mixed) and
measurements (in general non-projective) is unknown.

We then consider a reference experiment with a known pure state
$\ket{\tilde{\psi}}\in\mathbbm{C}^{d}$ for some $d$ and known measurements
$\tilde{M}_{i}$ acting on $\mathbbm{C}^{d}$. We assume that our reference
experiment also achieves the maximal quantum value of the given expression
$\mathcal{I}_{T}$. With these two experiments at hand, we can now introduce
the definition of self-testing in the case of contextuality or sequential
scenarios that was put forward in Irfan  _et al._ (2020):

######  Definition 2.

Suppose an unknown state $|\psi\rangle\in\mathcal{H}$ and a set of
measurements $M_{i}$ violate the temporal inequality $\mathcal{I}_{T}$
maximally. Then, this maximal quantum violation self-tests the state
$|\tilde{\psi}\rangle\in\mathbbm{C}^{d}$ and the set of measurements
$\tilde{M_{i}}$ such that there exists exists a projection
$P:\mathcal{H}\rightarrow\mathbb{C}^{d}$ and a unitary $U$ acting on
$\mathbbm{C}^{d}$ so that

$\displaystyle U^{\dagger}(P\,M_{i}\,P^{\dagger})U=\tilde{M}_{i},\>\>{\rm
and}\>\>U(P\,|\psi\rangle)=|\tilde{\psi}\rangle.$ (10)

Speaking alternatively, the above definition says that based on the observed
non-classicality one is able to identify a subspace $V=\mathbbm{C}^{d}$ in
$\mathcal{H}$ on which all the observables act invariantly. Equivalently,
$M_{i}$ can be decomposed as $M_{i}=\hat{M}_{i}\oplus\bar{M}_{i}$, where
$\hat{M}_{i}$ acts on $V$, whereas $\bar{M}_{i}$ acts on the orthogonal
complement of $V$ in $\mathcal{H}$; in particular, $\bar{M}_{i}\ket{\psi}=0$.
Moreover, there exists a unitary $U^{\dagger}\,\hat{M}_{i}\,U=\tilde{M}_{i}$.

##  III Self-testing of three-qubit complete graph state

###  III.1 Non-contextuality inequality

Taking inspiration from the previous works Irfan  _et al._ (2020);
Jebarathinam  _et al._ (2023); Santos  _et al._ (2022); Das  _et al._ (2022),
let us now introduce the following non-contextuality inequality for self-
testing the complete graph state of three qubits and a set of nine
observables:

$\displaystyle\mathcal{I}_{3}=$
$\displaystyle\braket{A_{1}A_{2}B_{3}M_{12}}+\braket{A_{1}B_{2}A_{3}M_{31}}+\braket{B_{1}A_{2}A_{3}M_{23}}$
$\displaystyle+\braket{A_{1}B_{2}B_{3}}+\braket{B_{1}A_{2}B_{3}}+\braket{B_{1}B_{2}A_{3}}-\braket{A_{1}A_{2}A_{3}}$
$\displaystyle+\braket{M_{23}M_{13}}+\braket{M_{13}M_{12}}+\braket{M_{23}M_{12}}$
$\displaystyle\leq\eta_{C}=8\leq\eta_{Q}=10,$ (11)

where $A_{i}$, $B_{j}$ and $M_{ij}$ are dichotomic observables with
eigenvalues $\pm 1$ and hence satisfy
$A^{2}_{i}=B^{2}_{i}=M_{ij}^{2}=\mathbbm{1}$. Note that the notation for
$M_{ij}$ is such that $M_{ij}$ and $M_{ji}$ represent the same observable.
This enables us to identify the symmetries of the inequality which are
convenient for the later proofs.

It can be checked that the classical bound of the inequality (III.1) can be
obtained by assigning the values $\pm 1$ to each variable $A_{i}$, $B_{j}$ and
$M_{ij}$ which implies $\eta_{C}=8$. And, the maximum algebraic value of
$\mathcal{I}_{3}$ is $\eta_{Q}=10$, which we can achieve with the following
choice of quantum operators:

$\displaystyle{A}_{i}=X_{i},\qquad{B}_{j}=Z_{j},\qquad M_{ij}=X_{i}\otimes
X_{j}\otimes Z_{k},$ (12)

and the graph state $|G_{3}\rangle$ in Eq. (9), where $i\neq j\neq
k\in\\{1,2,3\\}$. In fact, to derive the inequality (III.1) we exploited the
fact that the graph state $\ket{G_{3}}$ is an eigenstate of each of the
product of observables appearing in $\mathcal{I}_{3}$, except for
$A_{1}A_{2}A_{3}$ for which it is an eigenvector with eigenvalue $-1$.

Notice also that for readability, we use a compact notation to represent the
observables, eg., $X_{i}$, and $Z_{i}$ represent respectively the Pauli $X$
and $Z$ matrices acting on $i$-th qubit. As illustrations, for $n=3$ the
following should read like, ${A}_{2}=\mathbbm{1}\otimes X\otimes\mathbbm{1}$
and $M_{13}=M_{31}=X\otimes Z\otimes X$. We note that these operators obey the
following commutation relations for $i\neq j\neq k\in\\{1,2,3\\}$,

$\displaystyle[{A}_{i},{A}_{j}]$
$\displaystyle=[{A}_{i},{B}_{j}]=[{B}_{i},{B}_{j}]=[{A}_{i},M_{ij}]=[{A}_{j},M_{ij}]$
$\displaystyle=[{B}_{k},M_{ij}]=[M_{ij},M_{kj}]=0,$ (13)

as well as the following anti-commutation relations

$\displaystyle\\{A_{i},B_{i}\\}=\\{A_{k},M_{ij}\\}=\\{B_{i(j)},M_{ij}\\}=0.$
(14)

We also notice that the non-contextuality inequality (III.1), respects certain
symmetries. These symmetries can be listed as follows

$\displaystyle 1.\>\>\text{Permutation of indices}\quad i\leftrightarrow j.$
(15) $\displaystyle 2.\>\>\text{Cyclic permutation of indices, induced by
\eqref{symm1}.}$

In the next subsection, we propose a temporal non-contextuality inequality
derived from the Eq. (III.1) using the techniques proposed in II.2. We will
not assume the commutation relations from Eq. (III.1), rather, we will certify
the relations listed in Eqs. (III.1) and (14) from the maximal violation of
the proposed temporal inequality. Hence, the self-testing proof of the
measurements and the graph state $\ket{G_{3}}$ with the temporal non-
contextuality inequality also applies to the self-testing proof using the non-
contextuality inequality in (III.1).

Note that, we do not use the extant non-contextuality inequality from Ref.
Santos  _et al._ (2022). This is because the temporal extension of the non-
contextuality inequality in Santos  _et al._ (2022) does not certify all
required commutations relations.

###  III.2 Self-testing with the temporal inequality

The temporal inequality constructed from (III.1) has the following form

$\displaystyle T_{3}$ $\displaystyle:=$
$\displaystyle\braket{A_{1}A_{2}B_{3}M_{12}}_{\pi}+\braket{A_{3}A_{1}B_{2}M_{31}}_{\pi}+\braket{A_{2}A_{3}B_{1}M_{23}}_{\pi}+\braket{A_{1}B_{2}B_{3}}_{\pi}+\braket{B_{1}A_{2}B_{3}}_{\pi}+\braket{B_{1}B_{2}A_{3}}_{\pi}$
(16)
$\displaystyle-\braket{A_{1}A_{2}A_{3}}_{\pi}+\braket{M_{23}M_{31}}_{\pi}+\braket{M_{31}M_{12}}_{\pi}+\braket{M_{23}M_{12}}_{\pi}$
$\displaystyle\leq$ $\displaystyle\eta_{C}=8.$

It is direct to observe that the maximal quantum value of this expression
which equals also the maximal algebraic value amounts to $\eta_{Q}=10$ and is
achieved by the same state and observables as the maximal quantum value of
$\mathcal{I}_{3}$.

Our next task is to prove that the maximal quantum violation of the inequality
(16) can be used for certification of the graph state (9) along with the
observables in (12). To this aim, consider a quantum realization given by a
pure state $|\psi\rangle\in\mathcal{H}$ and a set of quantum observables
$A_{i},B_{j}$ and $M_{ij}$ with $i,j\in\\{1,2,3\\}$ acting on $\mathcal{H}$,
where $\mathcal{H}$ is some unknown Hilbert space. If the inequality in Eq.
(16) is maximally violated for a pure state $\ket{\psi}\in\mathcal{H}$ then
all the expectation values in the inequality, except the permutations of
$\braket{A_{1}A_{2}A_{3}}=-1$, take the value +1. Moreover, we can also get
the following set of relations

$\displaystyle A_{i}A_{j}B_{k}M_{ij}\ket{\psi}=\ket{\psi}\quad$
$\displaystyle\quad\text{+ permutations},$ (17) $\displaystyle
A_{i}B_{j}B_{k}\ket{\psi}=\ket{\psi}\quad$ $\displaystyle\quad\text{+
permutations},$ (18) $\displaystyle
A_{i}A_{j}A_{k}\ket{\psi}=-\ket{\psi}\quad$ $\displaystyle\quad\text{+
permutations},$ (19) $\displaystyle M_{ij}M_{ik}\ket{\psi}=\ket{\psi}\quad$
$\displaystyle\quad\text{+ permutations},$ (20)

where $i\neq j\neq k$ and by ‘$+$ permutations’, we mean that the relations
also hold for all possible permutation of the indices. Notice that although
the inequality (16) does not respect the symmetries (15) of the non-
contextuality inequality (III.1), the above relations (17)–(20) respect those
symmetries, which is sufficient for our purpose. From the above relations, we
can conclude that the following commutation relations hold on the state
$\ket{\psi}$.

######  Lemma 1.

Suppose the maximal quantum violation of inequality (16) is observed. Then,
for all $i\neq j\neq k\in\\{1,2,3\\}$, the operators $A_{i}$,$B_{j}$ and
$M_{ij}$ satisfy the following commutation relations on the state
$\ket{\psi}$,

$\displaystyle[{A}_{i},{A}_{j}]\ket{\psi}=[{A}_{i},{B}_{j}]\ket{\psi}=[{B}_{i},{B}_{j}]\ket{\psi}=[{A}_{i},M_{ij}]\ket{\psi}$
$\displaystyle=[{A}_{j},M_{ij}]\ket{\psi}=[{B}_{k},M_{ij}]\ket{\psi}=[M_{ij},M_{jk}]\ket{\psi}=0.$
(21)

###### Proof.

To prove this statement we can exploit the fact that the maximal violation of
inequality (16) implies that the relations in (17)–(20) are satisfied.

Let us begin with the first commutation relation in (1). To prove it we
observe that the third equality in (1) together with its permutations imply
that

$A_{i}A_{j}\ket{\psi}=A_{j}A_{i}\ket{\psi}=-A_{k}\ket{\psi},$ (22)

for any triple $i\neq j\neq k\in\\{1,2,3\\}$. Thus

$[A_{i},A_{j}]\ket{\psi}=0\qquad(i\neq j).$ (23)

The remaining relations in (1) can be proven in an analogous way. Precisely,
$[{A}_{i},{B}_{j}]\ket{\psi}=[{B}_{i},{B}_{j}]\ket{\psi}=0$ for any pair
$i\neq j$ follow from Eq. (18) and its permutations, whereas the commutation
relations between $A_{i}$ and $M_{ij}$ or $B_{k}$ and $M_{ij}$ follow from
(17). Finally, $[M_{ij},M_{jk}]\ket{\psi}=0$ is a consequence of the fourth
equality in Eq. (20).  $\sqcap$$\sqcup$

Next, we also prove the anti-commutation relations (14) between the operators
when acting on the state $\ket{\psi}$.

######  Lemma 2.

Suppose the maximal quantum violation of inequality (16) is observed. Then,
the operators $A_{i}$,$B_{j}$ and $M_{ij}$ along with the state $\ket{\psi}$
satisfy the following relations

$\displaystyle\\{A_{i},B_{i}\\}\ket{\psi}=\\{A_{k},M_{ij}\\}\ket{\psi}$
$\displaystyle=\\{B_{i},M_{ij}\\}\ket{\psi}=\\{B_{j},M_{ij}\\}\ket{\psi}=0$

for all triples $i\neq j\neq k\in\\{1,2,3\\}$,

###### Proof.

As in the case of the previous lemma we can again exploit the relations
(17)–(20). Let us first observe that they lead to the following chain of
relations:

$\displaystyle A_{i}B_{i}|\psi\rangle$ $\displaystyle=$ $\displaystyle
A_{i}A_{j}B_{k}|\psi\rangle=M_{ij}|\psi\rangle=M_{jk}|\psi\rangle$ (24)
$\displaystyle=$ $\displaystyle
B_{i}A_{k}A_{j}|\psi\rangle=-B_{i}A_{i}|\psi\rangle,$

where the first equality follows from Eq. (18), whereas the second one from
Eq. (17). Then, the third and fourth identities are consequences of Eqs. (20)
and (17), respectively. The last equality follows from Eq. (17). This proves
that $\\{A_{i},B_{i}\\}\ket{\psi}=0$ for any $i$.

Applying the same approach, we then have

$\displaystyle A_{i}M_{jk}|\psi\rangle$ $\displaystyle=$ $\displaystyle
A_{i}M_{k,i}|\psi\rangle=B_{j}A_{k}|\psi\rangle=B_{i}|\psi\rangle$ (25)
$\displaystyle=$ $\displaystyle
M_{jk}A_{k}A_{j}|\psi\rangle=-M_{jk}A_{i}|\psi\rangle,$

and

$\displaystyle B_{j}M_{jk}|\psi\rangle$ $\displaystyle=$ $\displaystyle
B_{j}M_{k,i}|\psi\rangle=A_{i}A_{k}|\psi\rangle=-A_{j}|\psi\rangle$ (26)
$\displaystyle=$ $\displaystyle-
M_{jk}B_{i}A_{k}|\psi\rangle=-M_{jk}B_{j}|\psi\rangle,$

which give the remaining anticommutation relations. A similar proof follows
for $\\{B_{k},M_{jk}\\}\ket{\psi}=0$.  $\sqcap$$\sqcup$

Lemmas 1 & 2 establish thus commutation and anticommutation relations for the
observables when acting on the state maximally violating our inequality. Let
us notice that the identities (17)–(20) allow us to derive even more relations
for the observables and the state:

$\displaystyle
A_{i}B_{i}|\psi\rangle=-B_{i}A_{i}|\psi\rangle=M_{12}|\psi\rangle=M_{23}|\psi\rangle=M_{31}|\psi\rangle,$
$\displaystyle
A_{i}M_{jk}|\psi\rangle=-M_{jk}A_{i}|\psi\rangle=B_{i}|\psi\rangle,$
$\displaystyle
B_{j}M_{jk}|\psi\rangle=-M_{jk}B_{j}|\psi\rangle=-A_{j}|\psi\rangle,$
$\displaystyle
B_{k}M_{jk}|\psi\rangle=-M_{jk}B_{k}|\psi\rangle=-A_{k}|\psi\rangle,$ (27)

$\forall$ $i\neq j\neq k$. These relations will be useful for the later
proofs.

Now, inspired by the approach of Ref. Irfan  _et al._ (2020), we define a
subspace

$\displaystyle V_{3}$ $\displaystyle:=$
$\displaystyle\mathrm{span}\\{|\psi\rangle,A_{1}|\psi\rangle,A_{2}|\psi\rangle,A_{3}|\psi\rangle,$
(28) $\displaystyle\hskip
28.45274ptB_{1}|\psi\rangle,B_{2}|\psi\rangle,B_{3}|\psi\rangle,A_{1}B_{1}|\psi\rangle\\},$

and prove the following fact for it.

######  Lemma 3.

Let the maximal quantum violation of inequality (16) is observed, then,
$V_{3}$ is an invariant subspace of all the observables $A_{i}$, $B_{j}$ and
$M_{ij}$ for $i,j\in\\{1,2,3\\}$.

###### Proof.

In order to prove this lemma we use Lemmas 1 & 2 as well as the relations in
Eqs. (17)–(20) and (III.2).

Let us begin with the first observable $A_{1}$ and notice that non-trivial
actions of $A_{1}$ on the subspace elements are:

  * •

$A_{1}(A_{2}\ket{\psi})=-A_{3}\ket{\psi}\in V_{3}$, which follows from Eq.
(19). This relation also implies that $A_{1}(A_{3}\ket{\psi})\in V_{3}$.

  * •

$A_{1}(B_{1}\ket{\psi})=-M_{ij}\ket{\psi}\in V_{3}$, which is a consequence of
the first identity in Eq. (III.2),

  * •

$A_{1}(B_{2}\ket{\psi})=B_{3}\ket{\psi}\in V_{3}$, which stems from Eq. (18).
This relation implies also that $A_{1}(B_{3}\ket{\psi})=B_{2}\ket{\psi}\in
V_{3}$.

  * •

$A_{1}A_{1}B_{1}\ket{\psi}=B_{1}\ket{\psi}\in V_{3}$.

Thus, the action of $A_{1}$ on every vector from $V_{3}$ produces a vector
belonging to $V_{3}$. By symmetry, the same conclusion can be drawn for
$A_{2}$ and $A_{3}$. Thus the subspace is invariant under the action of all
$A_{i}$’s. Similarly, the invariance of subspace can be shown under the action
all $B_{i}$’s.

Let us finally consider the observables $M_{ij}$. The first identity in Eq.
(III.2) says that $M_{ij}\ket{\psi}=A_{i}B_{i}\ket{\psi}$ for any $i$ and
$j\neq i$, and therefore the action of $M_{ij}$ on $\ket{\psi}$ or
$A_{1}B_{1}\ket{\psi}$ results in vectors that manifestly belong to $V_{3}$.
It then follows from Lemmas 1 and 2 that $M_{ij}$ either commutes or anti-
commutes with $A_{i}$ and $B_{i}$ on the state $\ket{\psi}$ which implies that
the action of $M_{ij}$ keeps the remaining vectors within $V_{3}$ up to a
negative sign. This completes the proof.  $\sqcap$$\sqcup$

It should be noticed that due to Eq. (III.2), the subspace $V_{3}$ stays the
same if one replaces the last vector $A_{1}B_{1}\ket{\psi}$ in Eq. (28) by
$A_{2}B_{2}|\psi\rangle$ or $A_{3}B_{3}|\psi\rangle$ or $M_{ij}\ket{\psi}$.

An important consequence of Lemma 3 is that the underlying Hilbert space
$\mathcal{H}$ and all the observables giving rise to the maximal violation of
inequality (16) split as $\mathcal{H}=V_{3}\oplus V^{\perp}_{3}$, where
$V_{3}^{\perp}$ is the orthogonal complement of $V_{3}$ in $\mathcal{H}$, and

$A_{i}=\hat{A}_{i}\oplus\bar{A}_{i},\quad
B_{j}=\hat{B}_{j}\oplus\bar{B}_{j},\quad
M_{ij}=\hat{M}_{ij}\oplus\bar{M}_{ij},$ (29)

where the hatted operators $\hat{A}_{i}$, $\hat{B}_{i}$ and $\hat{M}_{ij}$ are
defined on $V_{3}$, that is, $\hat{A}_{i}=PA_{i}P$ etc. with $P:\mathcal{H}\to
V_{3}$ being a projection onto $V_{3}$, whereas the remaining ones on
$V_{3}^{\perp}$. Since $\bar{A}_{i}$,$\bar{B}_{j}$ and $\bar{M}_{ij}$ act
trivially on $V_{3}$, that is,
$\bar{A}_{i}V_{3}=\bar{B}_{j}V_{3}=\bar{M}_{ij}V_{3}=0$, which means that the
observed correlations giving rise to the maximal violation of the inequality
(16) come solely from the subspace $V_{3}$, in what follows we can restrict
our attention to the operators $\hat{A}_{i}$, $\hat{B}_{j}$ and
$\hat{M}_{ij}$.

First, from the fact that $A_{i}$, $B_{j}$ and $M_{ij}$ are observables
obeying $A_{i}^{2}=B_{j}^{2}=M_{ij}^{2}=\mathbbm{1}$, it directly follows that
$\hat{A}_{i}$, $\hat{B}_{j}$ and $\hat{M}_{ij}$ are observables too and
satisfy

$\hat{A}_{i}^{2}=\hat{B}_{j}^{2}=\hat{M}_{ij}^{2}=\mathbbm{1}_{V_{3}}\qquad(i,j=1,2,3),$
(30)

where $\mathbbm{1}_{V_{3}}$ is the identity acting on $V_{3}$. Second, Eq.
(29) implies that the hatted observables must obey the same commutation
relations as $A_{i}$, $B_{j}$, and $M_{ij}$. We prove the following two lemmas
in Appendix B.

######  Lemma 4.

Suppose the maximal quantum violation of inequality (16) is observed. Then,
the operators $\hat{A}_{i}$, $\hat{B}_{i}$ and $\hat{M}_{ij}$ satisfy the
following commutation relations $\forall i\neq j\neq k\in\\{1,2,3\\}$,

$\displaystyle[\hat{A}_{i},\hat{A}_{j}]$
$\displaystyle=[\hat{A}_{i},\hat{B}_{j}]=[\hat{B}_{i},\hat{B}_{j}]=[\hat{A}_{i},\hat{M}_{ij}]=[\hat{A}_{j},\hat{M}_{ij}]$
$\displaystyle=[\hat{B}_{k},\hat{M}_{ij}]=[\hat{M}_{ij},\hat{M}_{jk}]=0.$

And lastly, it turns out that the anti-commutation relations in Lemma 2 also
apply to the observables on the subspace $V_{3}$.

######  Lemma 5.

Suppose the maximal quantum violation of the inequality (16) is observed.
Then, the following anti-commutation relations hold $\forall i\neq j\neq
k\in\\{1,2,3\\}$,

$\displaystyle\\{\hat{A}_{i},\hat{B}_{i}\\}=\\{\hat{A}_{k},\hat{M}_{ij}\\}=\\{\hat{B}_{i},\hat{M}_{ij}\\}=\\{\hat{B}_{j},\hat{M}_{ij}\\}=0.$

With Lemmas 4 and 5 at hand, we can now employ the standard approach that has
already been used in many non-locality-based self-testing schemes Kaniewski
(2016b); Kaniewski  _et al._ (2019); Sarkar  _et al._ (2021); Baccari  _et
al._ (2020b). Precisely, using this approach we can first infer that the
dimension $d$ of the subspace $V_{3}$ is even. To see this, note that from the
above anti-commutation relation between $\hat{A}_{i}$ and $\hat{B}_{i}$, we
have

$\hat{A}_{i}=-\hat{B}_{i}\hat{A}_{i}\hat{B}_{i}\quad\mathrm{or}\quad\hat{B}_{i}=-\hat{A}_{i}\hat{B}_{i}\hat{A}_{i},$
(31)

which after taking trace on both sides simplify to
$\mbox{tr}\hat{A}_{i}=\mbox{tr}\hat{B}_{i}=0$. Similarly we can show that
$\mbox{tr}(\hat{M}_{ij})=0$. It thus follows that both the eigenvalues $\pm 1$
of each observable $\hat{A}_{i}$, $\hat{B}_{i}$ or $\hat{M}_{ij}$ have equal
multiplicities. This clearly implies that the dimension $d=\dim V_{3}$ is an
even number, $d=2k$ for some $k\in\mathbbm{N}$, and thus
$V_{3}=\mathbbm{C}^{2}\otimes\mathbbm{C}^{k}$. On the other hand, since $\dim
V_{3}\leq 8$, one concludes that the possible values that $k$ can take are
$k=2,3,4$.

The fact that $\hat{A}_{1}$, $\hat{B}_{1}$ and $\hat{M}_{12}$ are traceless
together with the fact that they obey the commutation and anticommutation
relations established in Lemmas 4 and 5 imply that up to some unitary
operation these operators are equivalent to $X\otimes\mathbbm{1}_{k}$,
$Z\otimes\mathbbm{1}_{k}$ and $X\otimes Q_{k}$, where $\mathbbm{1}_{k}$ and
$Q_{k}$ are the identity and some operator on $\mathbbm{C}^{k}$ with $k=2,3,4$
(see for instance appendix B in Ref. Kaniewski  _et al._ (2019) for the proof
of this statement). This observation is one of the key ideas behind the proof
of the following lemma.

######  Lemma 6.

Suppose the maximal quantum violation of the inequality (16) is observed.
Then, there exists a unitary operator $U$ acting on $V_{3}$ such that

$\displaystyle U\hat{A}_{i}U^{\dagger}=X_{i},\quad
U\hat{B}_{j}U^{\dagger}=Z_{j},$ $\displaystyle U\hat{M}_{ij}U^{\dagger}=\pm
X_{i}\otimes X_{j}\otimes Z_{k}.$ (32)

###### Proof.

Using the result (Lemma 3) of Ref. Santos  _et al._ (2022), we can show that
there exists a unitary $U$, acting on the subspace
$V_{3}\cong\mathbbm{C}^{2}\otimes\mathbbm{C}^{2}\otimes\mathbbm{C}^{2}$, such
that the operators $\hat{A}_{i}$ and $\hat{B}_{i}$ have the form given in
Lemma 6. Then, our task is to determine the form of the operators
$\hat{M}_{ij}$.

Let us then move to the observables $\hat{M}_{ij}$ and consider first the
$\hat{M}_{12}$. Clearly, the "rotated" matrix $U\,\hat{M}_{12}\,U^{\dagger}$
can be decomposed as

$U\,\hat{M}_{12}\,U^{\dagger}=\mathbbm{1}\otimes\mathsf{M}_{0}+X\otimes\mathsf{M}_{1}+Y\otimes\mathsf{M}_{2}+Z\otimes\mathsf{M}_{3},$
(33)

where $\mathsf{M}_{i}$ are some $4\times 4$ matrices. Now, it is direct to
observe that the conditions that $U\,\hat{M}_{12}\,U^{\dagger}$ commutes with
$A_{1}$ and anticommutes with $B_{1}$ implies that

$U\,\hat{M}_{12}\,U^{\dagger}=X\otimes\mathsf{M}_{1}.$ (34)

Next, the conditions that $U\,\hat{M}_{12}\,U^{\dagger}$ commutes with $A_{2}$
and anticommutes with $B_{2}$ imply that the matrix $\mathsf{M}_{1}$ must obey
the following relations

$[X\otimes\mathbbm{1},\mathsf{M}_{1}]=\\{Z\otimes\mathbbm{1},\mathsf{M}_{1}\\}=0.$
(35)

Let us then decompose $\mathsf{M}_{1}$ in the following way

$\mathsf{M}_{1}=\mathbbm{1}\otimes\mathsf{N}_{0}+X\otimes\mathsf{N}_{1}+Y\otimes\mathsf{N}_{2}+Z\otimes\mathsf{N}_{3},$
(36)

where $\mathsf{N}_{i}$ are some $2\times 2$ matrices. After plugging the above
representation into Eq. (34), one easily finds that
$\mathsf{N}_{0}=\mathsf{N}_{2}=\mathsf{N}_{3}=0$, and therefore

$\mathsf{M}_{1}=X\otimes\mathsf{N}_{1}.$ (37)

To finally fix $\mathsf{N}_{1}$ one can exploit the fact that
$U\,\hat{M}_{12}\,U^{\dagger}$ commutes with $B_{3}$ and anticommutes with
$A_{3}$ which means that

$[Z,\mathsf{N}_{1}]=\\{X,\mathsf{N}_{1}\\}=0.$ (38)

The only matrix compatible with the above constraints is
$\mathsf{N}_{1}=\alpha Z$ for some $\alpha\in\mathbbm{C}$. However, since
$\hat{M}_{12}$ is a quantum observable such that
$\hat{M}_{12}^{2}=\mathbbm{1}$, one has that $\alpha=\pm 1$. As a result,

$U\,\hat{M}_{12}\,U^{\dagger}=\pm X_{1}\otimes X_{2}\otimes Z_{3}.$ (39)

Using then the same methodology one can then show that

$U\,\hat{M}_{ij}\,U^{\dagger}=\pm X_{i}\otimes X_{j}\otimes Z_{k}$ (40)

for any triple $i\neq j\neq k$, and thus under the action of the unitary
operation $U$, all the observables $\hat{A}_{i}$, $\hat{B}_{j}$ and $M_{ij}$
have the form given Eq. (6), which completes the proof.

$\sqcap$$\sqcup$

We can now present one of the main results of this paper.

######  Theorem 1.

If a quantum state $|\psi\rangle$ and a set of measurements $A_{i}$, $B_{i}$
and $M_{ij}$ with $i,j\in\\{1,2,3\\}$ maximally violate the inequality (16),
then there exists a projection $P:\mathcal{H}\rightarrow V_{3}$ with
$V_{3}=(\mathbbm{C}^{2})^{\otimes 3}$ and a unitary $U$ acting on $V_{3}$ such
that

$\displaystyle U^{\dagger}\,(P\,A_{i}\,P^{\dagger})\,U$ $\displaystyle=$
$\displaystyle X_{i},$ $\displaystyle U^{\dagger}\,(P\,B_{i}\,P^{\dagger})\,U$
$\displaystyle=$ $\displaystyle Z_{i},$ $\displaystyle
U^{\dagger}\,(P\,M_{ij}\,P^{\dagger})\,U$ $\displaystyle=$ $\displaystyle
X_{i}\otimes X_{j}\otimes Z_{k},$ (41)

and the state of the form,

$U(P|\psi\rangle)=|G_{3}\rangle$ (42)

with $|G_{3}\rangle$ being the three-qubit complete graph state defined in Eq.
(9).

###### Proof.

A quantum state $\ket{\psi}$ that belongs to a Hilbert space $\mathcal{H}$ and
a set of observables $\hat{A}_{i}$, $\hat{B}_{i}$, and $M_{ij}$ acting on
$\mathcal{H}$ attain the maximal quantum violation of the inequality (16) if
and only if they satisfy the set of relations (17)–(20). The algebraic
relations induced by this set of equations let us prove Lemmas 2-6 which imply
that there exists a projection $P:\mathcal{H}\rightarrow
V_{3}\cong\mathbbm{C}^{8}$ and a unitary operation
$U:\mathbbm{C}^{8}\to\mathbbm{C}^{8}$ for which Eqs. (6) hold true.

From the above characterization of the observables, we can infer the form of
the state $\ket{\psi}$. We will also fix the sign of all the observables
$\hat{M}_{ij}$. First, after plugging $\hat{A}_{i}$ and $\hat{B}_{i}$ into
Eqs. (18), one finds that the latter are the stabilizing relations of the
three-qubit complete graph state and thus $U(P\ket{\psi})=\ket{G_{3}}$. One
then observes that Eqs. (17) can only be satisfied if the sign of each of the
$U\,\hat{M}_{ij}\,U^{\dagger}$ observables in Eq. (6) is $+1$. Thus, the state
and observables maximally violating our inequality are of the form (1-42).
$\sqcap$$\sqcup$

Notice that the statement in Theorem 1 involves a global unitary operation,
and therefore it cannot be considered only a state certification, but rather
simultaneous certification of both the state and measurements giving rise to
the maximal violation of our inequality.

##  IV Self-testing of multi-qubit graph states

We will construct temporal non-contextual inequalities to certify multi-qubit
quantum systems, without assuming any commutation relations between the
operators. Importantly, the maximum violation of the new inequality will
enable us to verify the required commutation relations. The new inequalities
are such that the number of measurement operators grows polynomially with the
number of qubits. However, the number of correlators grows rapidly with the
number of qubits. The inequalities we propose generalize the inequalities
given in Eqs. (III.1) and (16).

###  IV.1 New scalable non-contextuality inequalities

We present new scalable non-contextuality inequalities (analogous to the
$n$-qubit inequalities in Santos  _et al._ (2022)) for which a temporal
extension will enable self-testing the multi-qubit states and measurements.
Consider a set of $n,n,\binom{n}{2}$ observables denoted by $A_{i}$, $B_{i}$
and $N_{ij}$ respectively, where $\\{i,j\\}\in\\{1,\ldots,n\\}$ and $i\neq j$.
These operators are assumed to obey the following commutation relations

$\displaystyle[A_{i},A_{j}]=[B_{i},B_{j}]=[A_{i},B_{j}]=[A_{i},N_{ij}]=[A_{j},N_{ij}]$
$\displaystyle=[B_{k},N_{ij}]=[N_{ij},N_{lm}]=0,$ (43)

where $i\neq j\neq k$ and $l\neq m$. It should be noted that $A_{k}$ commutes
with $N_{ij}$ if $k=i$ or $j$ while $B_{k}$ commutes with $N_{ij}$ if $k\neq
i$ and $j$. Therefore, it is evident that $N_{ij}$ is the generalization of
the observables $M_{ij}$ for arbitrary $n$-values. Also, note that
$N_{ij}=N_{ji}$.

We will now describe our construction of scalable non-contextuality
inequalities. Consider correlators of the following types,

$\displaystyle\langle B_{1}\ldots A_{i}\ldots A_{j}\ldots B_{k}\ldots
B_{n}N_{ij}\rangle,\quad\\#\binom{n}{2}$ $\displaystyle\langle B_{1}\ldots
B_{i-1}A_{i}B_{i+1}\ldots B_{n}\rangle,\quad\quad\quad\quad\\#n$
$\displaystyle\langle B_{1}\ldots A_{i}\ldots A_{j}\ldots A_{k}\ldots
B_{n}\rangle,\quad\quad\\#\binom{n}{3}$
$\displaystyle\quad\quad\quad\quad\langle
N_{ij}N_{jk}\rangle,\quad\quad\quad\quad\quad\quad\\#3\binom{n}{3}.$ (44)

where $i\neq j\neq k$, and on the right-hand side we added the number of
different correlators of a given type. Let us provide a few words of
explanation about these correlations. The correlators of the first type in
(IV.1) are that involve two measurements $A_{i}$ and $A_{j}$ for all pairs
$i\neq j$ and $n-2$ observables $B_{m}$ with $m\neq i\neq j$ and a single
observable $N_{ij}$. The second type involves those correlators that consist
of a single measurement $A_{i}$ and $n-1$ observables $B_{j}$. Then, we have
correlators containing observables $A_{i}$, $A_{j}$ and $A_{k}$ for all
triples of $i\neq j\neq k$ and $n-3$ $B_{i}$ observables at the remaining
’positions’. Lastly, the correlators $\langle N_{ij}N_{jk}\rangle$ are self-
explanatory.

Using these correlators let us now construct our non-contextuality inequality
for the $n$-qubit case to be of the following form,

$\displaystyle\mathcal{I}_{n}=$ $\displaystyle(n-2)\Big{(}\langle
A_{1}A_{2}B_{3}\ldots B_{n}N_{12}\rangle+\langle A_{1}B_{2}A_{3}\ldots
B_{n}N_{31}\rangle+\ldots+\langle B_{1}\ldots
A_{n-1}A_{n}N_{n-1,n}\rangle\Big{)}$ $\displaystyle+\alpha_{n}\Big{(}\langle
A_{1}B_{2}B_{3}B_{4}\ldots B_{n}\rangle+\langle B_{1}A_{2}B_{3}B_{4}\ldots
B_{n}\rangle+\langle B_{1}B_{2}A_{3}B_{4}\ldots B_{n}\rangle+\ldots+\langle
B_{1}B_{2}B_{3}B_{4}\ldots A_{n}\rangle\Big{)}$ $\displaystyle-\langle
A_{1}A_{2}A_{3}B_{4}\ldots B_{n}\rangle-\langle A_{1}A_{2}B_{3}A_{4}\ldots
B_{n}\rangle-\ldots-\langle B_{1}\ldots
B_{n-3}A_{n-2}A_{n-1}A_{n}\rangle+\langle N_{12}N_{23}\rangle$
$\displaystyle+\langle N_{23}N_{31}\rangle+\langle
N_{31}N_{12}\rangle\ldots+\langle N_{n-2,n-1}N_{n-1,n}\rangle+\langle
N_{n-1,n}N_{n,n-2}\rangle+\langle
N_{n,n-2}N_{n-2,n-1}\rangle\leq\eta_{C}^{(n)},$ (45)

where the constants $n-2$ and $\alpha_{n}=\binom{n-1}{2}$ have been added to
make the numbers of correlators of different types equal (cf. inequality
(III.1)), $\eta_{C}^{(n)}$ stands for the maximal classical value of
$\mathcal{I}_{n}$. To estimate the latter we can follow the pattern that one
might observe after considering the expressions $\mathcal{I}_{3}$ in (III.1)
and also $\mathcal{I}_{4}$ and $\mathcal{I}_{5}$ explicitly stated in Appendix
A. Indeed, we notice that the contribution from first line of Eq. (IV.1) is
equal to $(n-2)\binom{n}{2}=n\alpha_{n}$ which is exactly equal to the
contribution from second line. The last two lines contribute
$(3-1)\binom{n}{3}$. Therefore, the classical upper bound of $\mathcal{I}_{n}$
is

$\eta_{C}^{(n)}=2\alpha_{n}n+2\binom{n}{3}.$ (46)

At the same time, the maximal algebraic and at the same time the maximal
quantum value of the expression $\mathcal{I}_{n}$ amounts to

$\eta_{Q}^{(n)}=2\alpha_{n}n+4\binom{n}{3}$ (47)

and it is strictly larger than $\eta_{C}^{(n)}$ for any $n$.

Note here that for $n=3$ the above inequality reproduces the one in Eq.
(III.1) by replacing $N_{ij}$ with $M_{ij}$. The inequality in Eq. (IV.1) is
constructed in such a way so that for every three indices
$i,j,k\in\\{1,2,\ldots,n\\}$ such that $i\neq j\neq k$, we have an inequality
of the form of Eq. (III.1). To understand the connection, we refer
enthusiastic readers to Appendix A where we discuss in a more detailed way the
$n=4$ case.

Now, coming back to the inequality (IV.1), we see that it is non-trivial for
any $n$, i.e., $\eta^{(n)}_{C}<\eta^{(n)}_{Q}$. To prove this, we note that
the quantum bound $\eta^{(n)}_{Q}$ can be attained by the following
observables

$\displaystyle A_{i}=X_{i},\quad B_{j}=Z_{j},\quad N_{ij}=\pm X_{i}\otimes
X_{j}\bigotimes_{k\neq i,j}^{n}Z_{k},$ (48)

where these operators obey the commutation relations given in Eq. (IV.1).

To use the inequality Eq. (IV.1) for certification of the state and
measurements whenever the inequality is violated maximally, we note that the
operators must also satisfy the following relations,

$\displaystyle B_{1}\ldots A_{i}...\ldots A_{j}\ldots B_{k}\ldots
B_{n}N_{ij}\ket{\psi}=\ket{\psi}$ $\displaystyle B_{1}\ldots
B_{i-1}A_{i}B_{i+1}\ldots B_{n}\ket{\psi}=\ket{\psi}$ $\displaystyle
B_{1}\ldots A_{i}\ldots A_{j}\ldots A_{k}\ldots B_{n}\ket{\psi}=-\ket{\psi}$
$\displaystyle N_{ij}N_{jk}\ket{\psi}=\ket{\psi},$ (49)

where these relations hold true for all possible permutations of operators. In
the next section, we will use the above relations to obtain the form of
operators $A_{i},B_{j}$ and $N_{ij}$ and the state. In fact, we will obtain
the compatibility relations and the relations in (IV.1) from the maximum
violation of the temporal version of the inequality (IV.2).

Also, note here that, we do not use the extant $n$-qubit non-contextuality
inequality from Ref. Santos  _et al._ (2022) as its temporal extension does
not certify all required commutations relations.

###  IV.2 Self-testing with temporal extension of n-qubit non-contextuality
inequality

Using the similar prescription for $n=3$, we construct the temporal version of
the $n$-qubit non-contextuality inequality (IV.1), by replacing the sequential
expectation value terms with a sum of sequential correlations (2). The exact
form of our $n$-qubit temporal inequality is given by

$\displaystyle T_{n}=$ $\displaystyle(n-2)\Big{(}\langle A_{1}A_{2}B_{3}\ldots
B_{n}N_{12}\rangle_{\pi}+\langle A_{1}B_{2}A_{3}\ldots
B_{n}N_{31}\rangle_{\pi}+\ldots+\langle B_{1}\ldots
A_{n-1}A_{n}N_{n-1,n}\rangle_{\pi}\Big{)}$
$\displaystyle+\alpha_{n}\Big{(}\langle A_{1}B_{2}B_{3}B_{4}\ldots
B_{n}\rangle_{\pi}+\langle B_{1}A_{2}B_{3}B_{4}\ldots
B_{n}\rangle_{\pi}+\langle B_{1}B_{2}A_{3}B_{4}\ldots
B_{n}\rangle_{\pi}+\ldots+\langle B_{1}B_{2}B_{3}B_{4}\ldots
A_{n}\rangle_{\pi}\Big{)}$ $\displaystyle-\langle A_{1}A_{2}A_{3}B_{4}\ldots
B_{n}\rangle_{\pi}-\langle A_{1}A_{2}B_{3}A_{4}\ldots
B_{n}\rangle_{\pi}-\ldots-\langle B_{1}\ldots
B_{n-3}A_{n-2}A_{n-1}A_{n}\rangle_{\pi}$ $\displaystyle+\langle
N_{12}N_{23}\rangle_{\pi}+\langle N_{23}N_{31}\rangle_{\pi}+\langle
N_{31}N_{12}\rangle_{\pi}\ldots+\langle
N_{n-2,n-1}N_{n-1,n}\rangle_{\pi}+\langle
N_{n-1,n}N_{n,n-2}\rangle_{\pi}+\langle N_{n,n-2}N_{n-2,n-1}\rangle_{\pi}$
$\displaystyle\leq\eta_{C}^{(n)}=2\alpha_{n}n+2\binom{n}{3}<\eta_{Q}^{(n)}=2\alpha_{n}n+4\binom{n}{3}.$
(50)

We will now use the above inequality for certification of the complete graph
states of any number of qubits, and the measurements $A_{i}$ ,$B_{i}$ and
$N_{ij}$ given in Eq. (48). From the maximum violation of the above
inequality, we have all the temporal expectation value terms in $T_{n}$ taking
the value +1, except the expectation value terms of the form $\langle
B_{1}\ldots A_{i}\ldots A_{j}\ldots A_{k}\ldots B_{n}\rangle_{\pi}$ which
takes the value -1. In other words, the maximal violations give us the
relations in (IV.1). Using this we can prove the following lemma,

######  Lemma 7.

Suppose the maximal quantum violation of the inequality (IV.2) is observed.
Then, the operators $A_{i}$, $B_{i}$ and $N_{ij}$ obey the following
commutation relations,

$\displaystyle[A_{i},A_{j}]\ket{\psi}=[A_{i},B_{j}]\ket{\psi}=[B_{i},B_{j}]\ket{\psi}=[N_{ij},N_{jk}]\ket{\psi}$
$\displaystyle=[A_{i},N_{ij}]\ket{\psi}=[A_{j},N_{ij}]\ket{\psi}=[B_{k},N_{ij}]\ket{\psi}=0,$

where $i\neq j\neq k$.

###### Proof.

The proof is analogous to the one of Lemma Firstly, we define
$\mathcal{B}_{ijk}=\prod_{\begin{subarray}{c}m\neq
i,j,k\end{subarray}}^{n}B_{m}$ and then, by using the relations in (IV.1), we
can get the following relations which give the above commutators;

$\displaystyle\mathcal{B}_{ijk}A_{k}A_{i}A_{j}\ket{\psi}=\mathcal{B}_{ijk}A_{k}A_{j}A_{i}\ket{\psi}=-\ket{\psi},$
$\displaystyle\mathcal{B}_{ijk}B_{k}A_{i}B_{j}\ket{\psi}=\mathcal{B}_{ijk}B_{k}B_{j}A_{i}\ket{\psi}=\ket{\psi},$
$\displaystyle\mathcal{B}_{ijk}A_{k}B_{i}B_{j}\ket{\psi}=\mathcal{B}_{ijk}A_{k}B_{j}B_{i}\ket{\psi}=\ket{\psi},$
$\displaystyle\mathcal{B}_{ijk}A_{j}B_{k}A_{i}N_{ij}\ket{\psi}=\mathcal{B}_{ijk}A_{j}B_{k}N_{ij}A_{i}\ket{\psi}=\ket{\psi},$
$\displaystyle\mathcal{B}_{ijk}A_{i}A_{j}B_{k}N_{ij}\ket{\psi}=\mathcal{B}_{ijk}A_{i}A_{j}N_{ij}B_{k}\ket{\psi}=\ket{\psi},$
$\displaystyle{\rm and}\quad
N_{ij}N_{jk}\ket{\psi}=N_{jk}N_{ij}\ket{\psi}=\ket{\psi}.$

Note that the proof of $[A_{i},N_{ij}]=0$ is the same as the proof of
$[A_{j},N_{ij}]=0$ because of the symmetry of $N_{ij}$ with respect to its
indices.  $\sqcap$$\sqcup$

Moreover, we also have anti-commutation relations in the form of the following
lemma.

######  Lemma 8.

Suppose the maximal quantum violation of the inequality (IV.2) is observed.
Then, the operators $A_{i}$, $B_{i}$ and $N_{ij}$ obey the following anti-
commutation relations,

$\displaystyle\\{A_{i},B_{i}\\}|\psi\rangle=\\{A_{i},N_{jk}\\}|\psi\rangle=\\{B_{j},N_{jk}\\}|\psi\rangle$
$\displaystyle=\\{B_{k},N_{jk}\\}|\psi\rangle=0,\>\>{\rm where}\>\>i\neq j\neq
k.$

###### Proof.

Again, we will be using the relations from (IV.1) for the proof. We have the
following relations,

$\displaystyle
A_{i}B_{i}|\psi\rangle=A_{i}B_{k}A_{j}\mathcal{B}_{ijk}|\psi\rangle=N_{ij}|\psi\rangle=N_{jk}|\psi\rangle$
$\displaystyle=B_{i}A_{k}A_{j}\mathcal{B}_{ijk}|\psi\rangle=-B_{i}A_{i}|\psi\rangle,$
$\displaystyle
A_{i}N_{jk}|\psi\rangle=A_{i}N_{i,k}|\psi\rangle=A_{k}B_{j}\mathcal{B}_{ijk}|\psi\rangle=B_{i}|\psi\rangle$
$\displaystyle=N_{jk}A_{k}A_{j}\mathcal{B}_{ijk}|\psi\rangle=-N_{jk}A_{i}|\psi\rangle,$
$\displaystyle
B_{j}N_{jk}|\psi\rangle=B_{j}N_{i,k}|\psi\rangle=A_{k}A_{i}\mathcal{B}_{ijk}|\psi\rangle=-A_{j}|\psi\rangle$
$\displaystyle=-N_{jk}A_{k}B_{i}\mathcal{B}_{ijk}|\psi\rangle=-N_{jk}B_{j}|\psi\rangle.$

which gives the required anti-commutation relations. Note that the proof for
$\\{B_{j},N_{jk}\\}|\psi\rangle=0$ is similar to
$\\{B_{k},N_{jk}\\}|\psi\rangle=0$.  $\sqcap$$\sqcup$

Lemmas 7 and 8 thus establish commutation and anticommutation relations
between observables on the state maximally violating our inequality. What is
more, together with equations they enable and the relations in (IV.1), we can
also claim the following relations,

$\displaystyle
A_{i}B_{i}|\psi\rangle=-B_{i}A_{i}|\psi\rangle=A_{j}B_{j}|\psi\rangle=-B_{j}A_{j}|\psi\rangle=N_{ij}|\psi\rangle$
$\displaystyle\quad=N_{jk}|\psi\rangle=N_{i,k}|\psi\rangle=N_{k,l}|\psi\rangle,\>\>\forall
i\neq j\neq k\neq l.$ $\displaystyle
A_{i}N_{jk}|\psi\rangle=-N_{jk}A_{i}|\psi\rangle=B_{i}|\psi\rangle,\hskip
5.69054pt\forall i\neq j\neq k.$ $\displaystyle
B_{j}N_{jk}|\psi\rangle=-N_{jk}B_{j}|\psi\rangle=-A_{j}|\psi\rangle,\hskip
5.69054pt\forall j\neq k.$ $\displaystyle
B_{k}N_{jk}|\psi\rangle=-N_{jk}B_{k}|\psi\rangle=-A_{k}|\psi\rangle,\hskip
5.69054pt\forall j\neq k.$ (51)

Now we will use these relations to show that the following subspace is
invariant under the action of the operators $A_{i}$, $B_{i}$ and $N_{ij}$

$\displaystyle V_{n}$ $\displaystyle=$
$\displaystyle\mathrm{span}\\{\ket{\psi},B_{i_{1}}\ket{\psi},B_{i_{1}}B_{i_{2}}\ket{\psi},\ldots,B_{i_{1}}B_{i_{2}}\ldots
B_{i_{k}}\ket{\psi},$ (52) $\displaystyle\hskip
8.5359pt\ldots,B_{i_{1}}B_{i_{2}}\ldots B_{i_{n-1}}\ket{\psi},B_{1}\ldots
B_{n}\ket{\psi}\\},$

where $i_{j}\in[1,n]$ for any $j$ and
$i_{1}<\ldots<i_{k-1}<i_{k}<\ldots<i_{n-1}$. In the simplest cases of $n=3$
and $n=4$, the above construction gives

$\displaystyle
V_{3}=\mathrm{span}\\{\ket{\psi},B_{i}\ket{\psi},B_{i}B_{j}\ket{\psi},B_{1}B_{2}B_{3}\ket{\psi}\\},\>\>{\rm
and}$ $\displaystyle
V_{4}=\mathrm{span}\\{\ket{\psi},B_{i}\ket{\psi},B_{i}B_{j}\ket{\psi},B_{i}B_{j}B_{k}\ket{\psi},\prod_{i=1}^{4}B_{i}\ket{\psi}\\},$

with $i\neq j\neq k\in[1,4]$. In particular, $V_{3}$ is exactly the same as
the one defined in Eq. (28) by noticing that due to Eq. (18),
$B_{i}B_{j}\ket{\psi}=A_{k}\ket{\psi}$ with $i\neq j\neq k$ and
$B_{1}B_{2}B_{3}\ket{\psi}=-A_{1}B_{1}\ket{\psi}$.

This is the same subspace as was found in Irfan  _et al._ (2020) for the
$n$-qubit scenario. Hence, the number of vectors spanning $V_{n}$ is $2^{n}$
which implies $\dim V_{n}\leq 2^{n}$. In fact, we show later that $\dim
V_{n}=2^{n}$.

Our aim now is to identify the form of the operators $A_{i}$, $B_{j}$, and
$N_{ij}$ projected onto the subspace $V_{n}$. The method of the proof of self-
testing is similar to that used in the case $n=3$. In what follows, we prove
the following lemma in Appendix C,

######  Lemma 9.

Suppose the maximal quantum violation of the inequality (IV.2) is observed.
Then, the subspace $V_{n}$ of $\mathcal{H}_{n}$ is invariant under the action
of the operators $A_{i}$, $B_{j}$ and $N_{ij}$ for $i,j=[1,n]$.

Now, lemma 9 implies that $A_{i}$, $B_{j}$ and $N_{ij}$ can be represented as
a direct sum of two blocks,

$A_{i}=\hat{A}_{i}\oplus\bar{A}_{i},\qquad
B_{j}=\hat{B}_{j}\oplus\bar{B}_{j}\qquad
N_{ij}=\hat{N}_{ij}\oplus\bar{N}_{ij},$

where $\hat{A}_{i}$, $\hat{B}_{i}$ and $\hat{N}_{ij}$ are projections of
$A_{i}$ , $B_{i}$ and $N_{ij}$ onto $V_{n}$, that is
$\hat{A}_{i}=P_{n}A_{i}P_{n}$, $\hat{B}_{i}=P_{n}B_{i}P_{n}$ and
$\hat{N}_{ij}=P_{n}N_{ij}P_{n}$ with $P_{n}:\mathcal{H}_{n}\to V_{n}$ denoting
the projector onto $V_{n}$. On the other hand, $\bar{A}_{i}$, $\bar{B}_{j}$
and $\bar{N}_{ij}$ are defined on the orthogonal complement of $V_{n}$ in the
Hilbert space $\mathcal{H}_{n}$ that we denote $V_{n}^{\perp}$; clearly,
$\mathcal{H}_{n}=V_{n}\oplus V_{n}^{\perp}$.

Importantly, $\bar{A}_{i}$, $\bar{B}_{i}$ and $\bar{N}_{ij}$ act trivially on
the subspace $V_{n}$, in particular
$\bar{A}_{i}\ket{\psi}=B_{i}^{\prime}\ket{\psi}=\bar{N}_{ij}\ket{\psi}=0$, and
consequently it is enough for our purposes to characterize $\hat{A}_{i}$,
$\hat{B}_{j}$ and $\hat{N}_{ij}$. Our first step to achieving this goal is to
show that the following commutation and anti-commutation relations between the
hatted operators hold. We prove these relations in Appendix C.

######  Lemma 10.

Suppose the maximal quantum violation of the inequality (16) is observed, then
the following holds,

$\displaystyle[\hat{A}_{i},\hat{A}_{j}]=[\hat{A}_{i},\hat{B}_{j}]=[\hat{B}_{i},\hat{B}_{j}]=[\hat{B}_{k},\hat{N}_{ij}]=[\hat{A}_{i},\hat{N}_{ij}]$
$\displaystyle=[\hat{A}_{j},\hat{N}_{ij}]=[\hat{N}_{ij},\hat{N}_{jk}]=0,\>\>\forall
i\neq j\neq k\in[1,n].$

######  Lemma 11.

Suppose the maximal quantum violation of the inequality (16) is observed, then
the bellow relations holds $\forall$ $i\neq j\neq k\in[1,n]$,

$\displaystyle\\{\hat{A}_{i},\hat{B}_{i}\\}=\\{\hat{A}_{k},\hat{N}_{ij}\\}=\\{\hat{B}_{i},\hat{N}_{ij}\\}=\\{\hat{B}_{j},\hat{N}_{ij}\\}=0.$

Next, we are in a position to state the following results in a lemma which is
a straightforward generalization of Lemma 6.

######  Lemma 12.

Suppose the maximal quantum violation of our inequality (IV.2) is observed.
Then, there exists a unitary matrix $U$ acting on $V_{n}$ for which

$\displaystyle U\hat{A}_{i}U^{\dagger}=X_{i},\quad
U\hat{B}_{j}U^{\dagger}=Z_{j},$ $\displaystyle U\hat{N}_{ij}U^{\dagger}=\pm
X_{i}\otimes X_{j}\bigotimes_{k\neq i,j}^{n}Z_{k}.$ (53)

###### Proof.

Again, using the result (Lemma 6) of Ref. Santos  _et al._ (2022), we can show
that there exists a unitary $U$, acting on the subspace
$V_{n}\cong(\mathbbm{C}^{2})^{\otimes n}$, such that the operators
$\hat{A}_{i}$ and $\hat{B}_{i}$ have the form given in Lemma 12. Then, our
task is to determine the form of the operators $\hat{N}_{ij}$.

Using the structure of subspace, $V_{n}=(\mathbbm{C}^{2})^{\otimes n}$, one
can decompose $\hat{N}_{ij}$ in terms of the Pauli basis as

$U\hat{N}_{ij}U^{\dagger}=\bigotimes_{m=1}^{n}\sigma_{m},$

where $\sigma_{m}$ is a linear combination of Pauli matrices
$\\{\mathbbm{1}_{m},X_{m},Y_{m},Z_{m}\\}$. Now, using the same technique used
in the proof of Lemma 6, we get the following relations from Lemmas 10 and 11,

$\displaystyle\text{for}\quad m=i\quad\sigma_{m}=X,$
$\displaystyle\text{for}\quad m=j\quad\sigma_{m}=X,$
$\displaystyle\text{for}\quad m\neq i,j\quad\sigma_{m}=\pm Z.$

which gives the form of $\hat{N}_{ij}$.  $\sqcap$$\sqcup$

Thus, we are able to certify the measurements $A_{i}$, $B_{i}$, and $N_{ij}$,
without assuming commutation relations between the observables. Moreover, as
we can show that the dimension of $V_{n}$ is exactly $2^{n}$, our inequalities
can be seen as dimension witnesses: The dimension of the Hilbert space
supporting a state and observables giving rise to the maximal violation of our
inequalities must be at least $2^{n}$. Now, we present the main result in the
form of the following theorem.

######  Theorem 2.

If a quantum state $|\psi\rangle$ and a set of dichotomic observables $A_{i}$,
$B_{j}$ and $N_{ij}$ with $i,j\in[1,n]$ give rise to the maximal violation of
the temporal non-contextual inequality (IV.2), then there exists a projection
$P_{n}:\mathcal{H}_{n}\rightarrow V_{n}$ with $V_{n}=\mathbbm{C}^{2^{n}}$ and
a unitary $U$ acting on $\mathbbm{C}^{2^{n}}$ such that

$\displaystyle U^{\dagger}(P\,A_{i}\,P^{\dagger})U$ $\displaystyle=$
$\displaystyle X_{i},$ $\displaystyle U^{\dagger}(P\,B_{j}\,P^{\dagger})U$
$\displaystyle=$ $\displaystyle Z_{j},$ $\displaystyle
U^{\dagger}(P\,N_{ij}\,P^{\dagger})U$ $\displaystyle=$ $\displaystyle
X_{i}\otimes X_{j}\bigotimes_{k\neq i,j}^{n}Z_{k},$ $\displaystyle
U(P|\psi\rangle)$ $\displaystyle=$ $\displaystyle|G_{n}\rangle,$ (54)

where $|G_{n}\rangle$ is the complete graph state of $n$ qubits.

###### Proof.

The state $|\psi\rangle\in\mathcal{H}_{n}$ and observables
$A_{i},B_{i},N_{ij}$ acting on the Hilbert space $\mathcal{H}_{n}$ attain the
maximal quantum violation of the inequality (IV.2), if and only if, they
satisfy the set of $\binom{n}{2}+n+\binom{n}{3}+3\binom{n}{3}$ equations in
(IV.1). The algebra induced by this set of equations allows us to prove Lemmas
9, 10, 11 and 12; in particular, it follows that there exists a projection
$P_{n}:\mathcal{H}\rightarrow V_{n}\cong\mathbbm{C}^{2^{n}}$ and a unitary $U$
acting on $V_{n}$ such that the relations (12) holds. Then, we note that the
first equation of (IV.1) is satisfied only if the the sign of each
observables, $U\hat{N}_{ij}U^{\dagger}$ in (12) is $+1$.

Now, we note that the $n$ stabilizing relations from the second equation of
(IV.1) uniquely determine a state, $\ket{G_{n}}$, associated with the complete
graph with $n$ vertices. Therefore, we prove the theorem.  $\sqcap$$\sqcup$

##  V Conclusions

Quantum contextuality provides a unique avenue in extending the task of self-
testing quantum devices to scenarios where entanglement is not necessary or
spatial separation between the subsystems is not required (cf., Irfan  _et
al._ (2020); Saha  _et al._ (2020); Maity  _et al._ (2021); Santos  _et al._
(2022); Bharti  _et al._ (2019b); Das  _et al._ (2022)). However, such
contextuality-based certification schemes rely on the compatibility relations
among the measurements involved and are thus generally hard to implement in
practice.

In this paper, we overcome this limitation by using the temporal inequalities
derived from the non-contextuality inequalities, such that the maximal
violation of these new inequalities will certify these commutation relations
among the said measurement observables. In what follows, we are able to show
that the maximum violation of these temporal non-contextual inequalities can
be used for the certification of multi-qubit graph states and the
measurements.

Recently, we developed a similar method to certify a two-qubit maximally
entangled state and measurements from the maximal violation of a temporal non-
contextual inequality Jebarathinam  _et al._ (2023). Moreover, we were also
able to show that the scheme presented in Jebarathinam  _et al._ (2023) is
also robust to noise and small experimental errors. Since the certification
schemes presented in both works are similar, we expect that the certification
scheme presented in the current work is also robust to noise and small
experimental errors.

Furthermore, it would be interesting to identify which other non-contextuality
inequality-based self-testing schemes can be converted to temporal
inequalities so that they can still be used for self-testing of the states and
measurements. Further research is needed to improve the scalability of our
scheme with the number of certified qubits.

## acknowledgments

This work was supported by the Polish National Science Centre through the
SONATA BIS project No. 2019/34/E/ST2/00369. SS acknowledges funding through
PASIFIC program call 2 (Agreement No. PAN.BFB.S.BDN.460.022 with the Polish
Academy of Sciences). This project has received funding from the European
Union’s Horizon 2020 research and innovation programme under the Marie
Skłodowska-Curie grant agreement No 847639 and from the Ministry of Education
and Science of Poland.

## References

  * Raussendorf and Briegel (2001) R. Raussendorf and H. J. Briegel, Phys. Rev. Lett. 86, 5188 (2001).
  * Kok  _et al._ (2007) P. Kok, W. J. Munro, K. Nemoto, T. C. Ralph, J. P. Dowling, and G. J. Milburn, Rev. Mod. Phys. 79, 135 (2007).
  * Shor (1995) P. W. Shor, Phys. Rev. A 52, R2493 (1995).
  * Terhal (2015) B. M. Terhal, Rev. Mod. Phys. 87, 307 (2015).
  * Borregaard  _et al._ (2020) J. Borregaard, H. Pichler, T. Schröder, M. D. Lukin, P. Lodahl, and A. S. Sørensen, Phys. Rev. X 10, 021071 (2020).
  * Hilaire  _et al._ (2021) P. Hilaire, E. Barnes, and S. E. Economou, Quantum 5, 397 (2021).
  * Lanyon  _et al._ (2010) B. P. Lanyon, J. D. Whitfield, G. G. Gillett, M. E. Goggin, M. P. Almeida, I. Kassal, J. D. Biamonte, M. Mohseni, B. J. Powell, M. Barbieri, _et al._ , Nature chemistry 2, 106 (2010).
  * Ma  _et al._ (2011) X.-s. Ma, B. Dakic, W. Naylor, A. Zeilinger, and P. Walther, Nature Physics 7, 399 (2011).
  * Gaertner  _et al._ (2007) S. Gaertner, C. Kurtsiefer, M. Bourennane, and H. Weinfurter, Phys. Rev. Lett. 98, 020503 (2007).
  * Epping  _et al._ (2017) M. Epping, H. Kampermann, C. macchiavello, and D. Bruß, New Journal of Physics 19, 093012 (2017).
  * Thew  _et al._ (2002) R. T. Thew, K. Nemoto, A. G. White, and W. J. Munro, Phys. Rev. A 66, 012303 (2002).
  * Kiesel  _et al._ (2005) N. Kiesel, C. Schmid, U. Weber, G. Tóth, O. Gühne, R. Ursin, and H. Weinfurter, Phys. Rev. Lett. 95, 210502 (2005).
  * Mayers and Yao (2004) D. Mayers and A. Yao, Quantum Inf. Comput 4, 273–286 (2004).
  * Šupić and Bowles (2020) I. Šupić and J. Bowles, Quantum 4, 337 (2020).
  * Kaniewski (2016a) J. Kaniewski, Phys. Rev. Lett. 117, 070402 (2016a).
  * Baccari  _et al._ (2020a) F. Baccari, R. Augusiak, I. Šupić, J. Tura, and A. Acín, Phys. Rev. Lett. 124, 020402 (2020a).
  * Panwar  _et al._ (2022) E. Panwar, P. Pandya, and M. Wieśniak, arXiv preprint arXiv:2202.06908 (2022).
  * Kochen and Specker (1967) S. Kochen and E. P. Specker, J. Math. Mech. 17, 59 (1967).
  * Leggett and Garg (1985) A. J. Leggett and A. Garg, Phys. Rev. Lett. 54, 857 (1985).
  * Budroni and Emary (2014) C. Budroni and C. Emary, Phys. Rev. Lett. 113, 050401 (2014).
  * Brierley  _et al._ (2015) S. Brierley, A. Kosowski, M. Markiewicz, T. Paterek, and A. Przysiężna, Phys. Rev. Lett. 115, 120404 (2015).
  * Bharti  _et al._ (2019a) K. Bharti, M. Ray, A. Varvitsiotis, N. A. Warsi, A. Cabello, and L.-C. Kwek, Phys. Rev. Lett. 122, 250403 (2019a).
  * Irfan  _et al._ (2020) A. A. M. Irfan, K. Mayer, G. Ortiz, and E. Knill, Phys. Rev. A 101, 032106 (2020).
  * Saha  _et al._ (2020) D. Saha, R. Santos, and R. Augusiak, Quantum 4, 302 (2020).
  * Maity  _et al._ (2021) A. G. Maity, S. Mal, C. Jebarathinam, and A. S. Majumdar, Phys. Rev. A 103, 062604 (2021).
  * Santos  _et al._ (2022) R. Santos, C. Jebarathinam, and R. Augusiak, Phys. Rev. A 106, 012431 (2022).
  * Bharti  _et al._ (2019b) K. Bharti, M. Ray, A. Varvitsiotis, N. A. Warsi, A. Cabello, and L.-C. Kwek, Phys. Rev. Lett. 122, 250403 (2019b).
  * Das  _et al._ (2022) D. Das, A. G. Maity, D. Saha, and A. S. Majumdar, Quantum 6, 716 (2022).
  * Jebarathinam  _et al._ (2023) C. Jebarathinam, G. Sharma, S. Sazim, and R. Augusiak, arXiv e-prints , arXiv:2307.06710 (2023), arXiv:2307.06710 [quant-ph] .
  * Majidy  _et al._ (2021) S. Majidy, J. J. Halliwell, and R. Laflamme, Phys. Rev. A 103, 062212 (2021).
  * Pan  _et al._ (2018) A. K. Pan, M. Qutubuddin, and S. Kumari, Phys. Rev. A 98, 062115 (2018).
  * Markiewicz  _et al._ (2014) M. Markiewicz, P. Kurzyński, J. Thompson, S.-Y. Lee, A. Soeda, T. Paterek, and D. Kaszlikowski, Phys. Rev. A 89, 042109 (2014).
  * Hein  _et al._ (2006) M. Hein, W. Dür, J. Eisert, R. Raussendorf, M. Nest, and H.-J. Briegel, arXiv preprint quant-ph/0602096 (2006).
  * Gottesman (1996) D. Gottesman, Phys. Rev. A 54, 1862 (1996).
  * Kaniewski (2016b) J. Kaniewski, Phys. Rev. Lett. 117, 070402 (2016b).
  * Kaniewski  _et al._ (2019) J. Kaniewski, I. Šupić, J. Tura, F. Baccari, A. Salavrakos, and R. Augusiak, Quantum 3, 198 (2019).
  * Sarkar  _et al._ (2021) S. Sarkar, D. Saha, J. Kaniewski, and R. Augusiak, npj Quantum Inf. 7, 151 (2021).
  * Baccari  _et al._ (2020b) F. Baccari, R. Augusiak, I. Šupić, J. Tura, and A. Acín, Phys. Rev. Lett. 124, 020402 (2020b).

##  Appendix A The special case of $n=4$ of non-contextual inequality (IV.1)

The non-contextual inequality (IV.1) is constructed in such a way that for
every index $i\neq j\neq k\in[1,n]$, we have an inequality of the form of Eq.
(III.1). We explain it by expanding the inequality for $n=4$,

$\displaystyle\mathcal{I}_{4}=$ $\displaystyle 2(\langle
A_{1}A_{2}B_{3}B_{4}N_{12}\rangle+\langle
A_{1}A_{3}B_{2}B_{4}N_{13}\rangle+\langle
A_{1}A_{4}B_{2}B_{3}N_{14}\rangle+\langle
A_{2}A_{3}B_{1}B_{4}N_{23}\rangle+\langle A_{2}A_{4}B_{1}B_{3}N_{24}\rangle$
$\displaystyle+\langle A_{3}A_{4}B_{1}B_{2}N_{34}\rangle)+3\left(\langle
A_{1}B_{2}B_{3}B_{4}\rangle+\langle B_{1}A_{2}B_{3}B_{4}\rangle+\langle
B_{1}B_{2}A_{3}B_{4}\rangle+\langle B_{1}B_{2}B_{3}A_{4}\rangle\right)$
$\displaystyle-\langle B_{1}A_{2}A_{3}A_{4}\rangle-\langle
A_{1}B_{2}A_{3}A_{4}\rangle-\langle A_{1}A_{2}B_{3}A_{4}\rangle-\langle
A_{1}A_{2}A_{3}B_{4}\rangle+\langle N_{12}N_{13}\rangle+\langle
N_{23}N_{13}\rangle$ $\displaystyle+\langle N_{12}N_{23}\rangle+\langle
N_{12}N_{14}\rangle+\langle N_{24}N_{14}\rangle+\langle
N_{12}N_{24}\rangle+\langle N_{14}N_{13}\rangle+\langle
N_{34}N_{13}\rangle+\langle N_{14}N_{34}\rangle\ $ $\displaystyle+\langle
N_{24}N_{34}\rangle+\langle N_{23}N_{34}\rangle+\langle
N_{24}N_{23}\rangle\leq\eta^{(4)}_{C}=32<\eta^{(4)}_{Q}=40.$ (55)

Rearranging the terms in $\mathcal{I}_{4}$ so that for the four sets of three
indices, we have one of the four expressions,

$\displaystyle\mathcal{I}_{4}$
$\displaystyle=(\braket{B_{4}A_{1}A_{2}B_{3}N_{12}}+\braket{B_{4}A_{1}B_{2}A_{3}N_{31}}+\braket{B_{4}B_{1}A_{2}A_{3}N_{23}}+\langle
B_{4}A_{1}B_{2}B_{3}\rangle+\langle B_{4}B_{1}A_{2}B_{3}\rangle+\langle
B_{4}B_{1}B_{2}A_{3}\rangle$ $\displaystyle-\langle
B_{4}A_{1}A_{2}A_{3}\rangle+\langle N_{12}N_{13}\rangle+\langle
N_{23}N_{13}\rangle+\langle N_{12}N_{23}\rangle)$
$\displaystyle+(\braket{B_{3}A_{1}A_{2}B_{4}N_{12}}+\braket{B_{3}A_{1}B_{2}A_{4}N_{14}}+\braket{B_{3}B_{1}A_{2}A_{4}N_{24}}+\langle
B_{3}A_{1}B_{2}B_{4}\rangle+\langle B_{3}B_{1}A_{2}B_{4}\rangle+\langle
B_{3}B_{1}B_{2}A_{4}\rangle$ $\displaystyle-\langle
B_{3}A_{1}A_{2}A_{4}\rangle+\langle N_{12}N_{14}\rangle+\langle
N_{24}N_{14}\rangle+\langle N_{12}N_{24}\rangle)$
$\displaystyle+(\braket{B_{2}A_{1}B_{3}A_{4}N_{14}}+\braket{B_{2}A_{1}A_{3}B_{4}N_{13}}+\braket{B_{2}B_{1}A_{3}A_{4}N_{34}}+\langle
B_{2}A_{1}B_{3}B_{4}\rangle+\langle B_{2}B_{1}B_{3}A_{4}\rangle+\langle
B_{2}B_{1}A_{3}B_{4}\rangle$ $\displaystyle-\langle
B_{2}A_{1}A_{3}A_{4}\rangle+\langle N_{14}N_{13}\rangle+\langle
N_{34}N_{13}\rangle+\langle N_{14}N_{34}\rangle)$
$\displaystyle+(\braket{B_{1}A_{2}B_{3}A_{4}N_{24}}+\braket{B_{1}A_{2}A_{3}B_{4}N_{23}}+\braket{B_{1}B_{2}A_{3}A_{4}N_{34}}+\langle
B_{1}A_{2}B_{3}B_{4}\rangle+\langle B_{1}B_{2}B_{3}A_{4}\rangle+\langle
B_{1}B_{2}A_{3}B_{4}\rangle$ $\displaystyle-\langle
B_{1}A_{2}A_{3}A_{4}\rangle+\langle N_{24}N_{23}\rangle+\langle
N_{34}N_{23}\rangle+\langle N_{24}N_{34}\rangle).$ (56)

From the above form, it is clear that $\mathcal{I}_{4}$ consists of four
expressions of the form (III.1). For example, when $i=1,j=2$ and $k=4$ in Eqs.
(IV.1), we have the following terms for $\mathcal{I}_{4}$

$\displaystyle\braket{B_{3}A_{1}A_{2}B_{4}N_{12}}$
$\displaystyle+\braket{B_{3}A_{1}B_{2}A_{4}N_{14}}+\braket{B_{3}B_{1}A_{2}A_{4}N_{24}}+\langle
B_{3}A_{1}B_{2}B_{4}\rangle+\langle B_{3}B_{1}A_{2}B_{4}\rangle$
$\displaystyle+\langle B_{3}B_{1}B_{2}A_{4}\rangle-\langle
B_{3}A_{1}A_{2}A_{4}\rangle+\langle N_{12}N_{14}\rangle+\langle
N_{24}N_{14}\rangle+\langle N_{12}N_{24}\rangle,$

where we see that we have a $B_{3}$ sitting in from of all the terms from
inequality (III.1) except for $\langle N_{ij}N_{jk}\rangle$ terms. Likewise,
we have three other expressions. Therefore, it is direct to find that
$\eta^{(4)}_{C}=4\times 8=32$.

##  Appendix B Commutation and anti-commutation relations for hatted operators
in three-qubit scenario

The proof of Lemma 4.– If we can show that the operators $A_{i}$, $B_{j}$, and
$M_{ij}$ follow the aforementioned commutation relations on the subspace
$V_{3}$, it would also immediately imply the commutation relations for the
hatted operators. Now consider the commutators $[A,B]$ acting on
$M\ket{\psi}\in V_{3}$ so that $A,B,M$ appear together in any sequential
correlation terms in inequality (16). We can always get the following
$[A,B]M\ket{\psi}=M[A,B]\ket{\psi}$ from the relations (17)-(20) which contain
all the possible permutations. So in the following, we exclude such trivial
scenarios and will consider only those commutators and subspace vectors so
that the operators $A,B,M$ do not appear together in any sequential
correlation terms in inequality (16).

For the commutation $[A_{i},A_{j}]=0\in V_{3}$, we find that the following
relation is the only non-trivial one to show,

$\displaystyle[A_{i},A_{j}]B_{i}\ket{\psi}=(A_{i}B_{k}-A_{j}M_{ij})\ket{\psi}=0$

which follows from $A_{j}B_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (18),
$B_{k}A_{i}A_{j}M_{ij}\ket{\psi}=\ket{\psi}$ (Eq. 17) and
$A_{i}B_{i}\ket{\psi}=M_{ij}\ket{\psi}$ (Eq. III.2). Similarly, for
$[A_{i},B_{j}]=0\in V_{3}$, we need to show the following two relations only.
First one is

$\displaystyle[A_{i},B_{j}]B_{i}\ket{\psi}=(A_{i}A_{k}-B_{j}M_{ik})\ket{\psi}=0$

using $A_{k}B_{j}B_{i}\ket{\psi}=\ket{\psi}$ from Eq. (18),
$A_{k}A_{i}B_{j}M_{ik}\ket{\psi}=\ket{\psi}$ from Eq. (17) and
$A_{i}B_{i}\ket{\psi}=M_{jk}\ket{\psi}$ from Eq. (III.2). And the second one
is found to be

$\displaystyle[A_{i},B_{j}]A_{j}\ket{\psi}=(-A_{i}M_{ik}+B_{j}A_{k})\ket{\psi}=0$

using $B_{j}A_{j}\ket{\psi}=-M_{ik}\ket{\psi}$ from Eq. (III.2),
$A_{k}A_{i}A_{j}\ket{\psi}=-\ket{\psi}$ from Eq. (19) and
$M_{ik}A_{i}B_{j}A_{k}\ket{\psi}=\ket{\psi}$ from Eq. (17). Next, for
$[B_{i},B_{j}]=0\in V_{3}$, we need to prove three non-trivial cases. We first
have

$\displaystyle[B_{i},B_{j}]A_{i}\ket{\psi}=(B_{i}B_{k}-B_{j}M_{ik})\ket{\psi}=(A_{j}+A_{i}A_{k})\ket{\psi}=0$

using $B_{k}B_{j}A_{i}\ket{\psi}=\ket{\psi}$ from Eq. (18),
$A_{j}A_{i}A_{k}\ket{\psi}=-\ket{\psi}$ from Eq. (19) and
$B_{i}A_{i}\ket{\psi}=-M_{ik}$ from Eq. (III.2). It is easy to see that a
similar proof works for $[B_{i},B_{j}]A_{j}\ket{\psi}=0$. Further, we can see
that following holds

$\displaystyle[B_{i},B_{j}]B_{k}\ket{\psi}=(B_{i}A_{i}-B_{j}A_{j})\ket{\psi}=0$

by using $A_{i}B_{j}B_{k}\ket{\psi}=\ket{\psi}$ and
$A_{j}B_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (18). Lastly, we find below
one

$\displaystyle[B_{i},B_{j}]M_{ij}\ket{\psi}=(-B_{i}A_{j}+B_{j}A_{i})\ket{\psi}=(B_{k}-B_{k})\ket{\psi}=0$

using $B_{j}M_{ij}\ket{\psi}=-A_{j}\ket{\psi}$ from Eq. (17),
$A_{i}B_{j}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (18) and
$B_{i}M_{ij}\ket{\psi}=-A_{i}\ket{\psi}$ from Eq. (III.2).

For $[A_{i},M_{ij}]=0\in V_{3}$, we show the following relation

$\displaystyle[A_{i},M_{ij}]A_{k}\ket{\psi}=(-A_{i}B_{k}+M_{ij}A_{j})\ket{\psi}=0$

using $M_{ij}A_{k}\ket{\psi}=B_{k}\ket{\psi}$ from Eq. (III.2) and
$A_{j}A_{i}A_{k}\ket{\psi}=-\ket{\psi}$ and
$B_{k}A_{i}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$ from Eq.
(LABEL:3qubitallpermutations). Next,

$\displaystyle[A_{i},M_{ij}]B_{i}\ket{\psi}=(A_{i}A_{i}-M_{ij}M_{ij})\ket{\psi}=0,$

by considering $M_{ij}B_{i}\ket{\psi}=A_{i}\ket{\psi}$ and
$A_{i}B_{i}\ket{\psi}=M_{ij}\ket{\psi}$ from Eq. (III.2). Lastly, we have
$[A_{i},M_{ij}]B_{j}\ket{\psi}=(A_{i}A_{j}-M_{ij}B_{k})\ket{\psi}=0$ which
follows a similar arguments. It is also clear that the above proofs work
equally for $[A_{j},M_{ij}]=0\in V_{3}$, as the operator $M_{ij}$ is symmetric
with respect to the exchange of indices. Now, for $[B_{k},M_{ij}]=0\in V_{3}$,
we show

$\displaystyle[B_{k},M_{ij}]A_{k}\ket{\psi}=(-B_{k}B_{k}+M_{ij}M_{ij})\ket{\psi}=0$

holds using $M_{ij}A_{k}\ket{\psi}=-B_{k}\ket{\psi}$ and
$B_{k}A_{k}\ket{\psi}=M_{ij}\ket{\psi}$ from Eq. (III.2)). Then, one can prove
following

$\displaystyle[B_{k},M_{ij}]B_{i}\ket{\psi}=(B_{k}A_{i}-M_{ij}A_{j})\ket{\psi}=0$

by utilizing $M_{ij}B_{i}\ket{\psi}=A_{i}\ket{\psi}$ from Eq. (III.2),
$A_{j}B_{k}B_{i}\ket{\psi}=\ket{\psi}$ and
$A_{i}B_{k}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$ from Eq.
(LABEL:3qubitallpermutations).

For $[M_{ij},M_{jk}]=0\in V_{3}$, we have the following four non-trivial
commutation relations. First one being

$\displaystyle[M_{ij},M_{jk}]A_{i}\ket{\psi}=(-M_{ij}B_{i}-M_{jk}A_{j}B_{k})\ket{\psi}=(-A_{i}-M_{jk}B_{i})\ket{\psi}=(-A_{i}-A_{j}A_{k})\ket{\psi}=0$

using $M_{jk}A_{i}\ket{\psi}=-B_{i}\ket{\psi}$, $M_{ij}B_{i}\ket{\psi}=A_{i}$
from Eq. (III.2), $M_{ij}A_{i}A_{j}B_{k}\ket{\psi}=\ket{\psi}$,
$B_{i}A_{j}B_{k}\ket{\psi}=\ket{\psi}$,
$A_{j}A_{k}B_{i}M_{jk}\ket{\psi}=\ket{\psi}$, and
$A_{i}A_{j}A_{k}\ket{\psi}=-\ket{\psi}$ from Eq. (17)-(19). Second, we show

$\displaystyle[M_{ij},M_{jk}]A_{j}\ket{\psi}=(M_{ij}A_{k}B_{i}-M_{jk}A_{i}B_{k})\ket{\psi})=(M_{ij}B_{j}-M_{jk}B_{j})\ket{\psi}=0$

using $B_{i}A_{k}M_{jk}A_{j}\ket{\psi}=\ket{\psi}$,
$B_{k}A_{i}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$,
$A_{k}B_{i}\ket{\psi}=A_{i}B_{k}\ket{\psi}=B_{j}\ket{\psi}$ from Eq. (17)-(19)
and $M_{ij}B_{j}\ket{\psi}=A_{j}\ket{\psi}$ from Eq. (III.2). Third, one can
deduce that the below relation

$\displaystyle[M_{ij},M_{jk}]B_{i}\ket{\psi}=(M_{ij}A_{j}A_{k}-M_{jk}A_{i})\ket{\psi}=(-M_{ij}A_{i}+B_{i})\ket{\psi}=(-A_{j}B_{k}+B_{i})\ket{\psi}=0$

does hold as $A_{k}A_{j}M_{jk}B_{i}\ket{\psi}=\ket{\psi}$,
$M_{ij}B_{i}\ket{\psi}=A_{i}\ket{\psi}$,
$A_{i}A_{j}A_{k}\ket{\psi}=-\ket{\psi}$,
$B_{k}A_{j}M_{ij}A_{i}\ket{\psi}=\ket{\psi}$,
$B_{i}A_{j}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (17)-(19) and
$M_{jk}A_{i}\ket{\psi}=-B_{i}\ket{\psi}$ from Eq. (III.2). Finally, it is easy
to show that

$\displaystyle[M_{ij},M_{jk}]B_{j}\ket{\psi}=(M_{ij}A_{j}-M_{jk}A_{j})\ket{\psi}=(A_{i}B_{k}-A_{k}B_{i})\ket{\psi}=(B_{j}-B_{j})\ket{\psi}=0$

holds using $M_{jk}B_{j}\ket{\psi}=A_{j}\ket{\psi}$,
$M_{ij}B_{j}\ket{\psi}=A_{j}\ket{\psi}$ from Eq. (III.2),
$B_{k}A_{i}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$ plus its permutations,
$B_{j}A_{i}B_{k}\ket{\psi}=\ket{\psi}$ and
$B_{j}A_{k}B_{i}\ket{\psi}=\ket{\psi}$ from Eqs. (17)-(18). $\sqcap$$\sqcup$

The proof of Lemma 5.– As we had proven for the commutators, if we can show
that the anti-commutators from Lemma 2 hold on the subspace $V_{3}$, then the
anti-commutation relations will also hold for the hatted operators. For
$\\{A_{i},B_{i}\\}=0\in V_{3}$, we need to consider five non-trial cases. The
first one,

$\displaystyle\\{A_{i},B_{i}\\}A_{i}\ket{\psi}=(-A_{i}M_{jk}+B_{i})\ket{\psi}=0$

follows using $B_{i}A_{i}\ket{\psi}=-M_{jk}\ket{\psi}$ and
$A_{i}M_{jk}\ket{\psi}=B_{i}\ket{\psi}$ from Eq. (III.2). Then, one shows

$\displaystyle\\{A_{i},B_{i}\\}A_{j}\ket{\psi}=(A_{i}B_{k}-B_{i}A_{k})\ket{\psi}=0$

using $B_{k}B_{i}A_{j}\ket{\psi}=\ket{\psi}$,
$A_{k}A_{i}A_{j}\ket{\psi}=-\ket{\psi}$,
$B_{j}A_{i}B_{k}\ket{\psi}=B_{j}B_{i}A_{k}\ket{\psi}=\ket{\psi}$ from Eq.
(18)-(19). Next, we find that

$\displaystyle\\{A_{i},B_{i}\\}B_{i}\ket{\psi}=(A_{i}+B_{i}M_{ij})\ket{\psi}=0$

holds using the relation $A_{i}B_{i}\ket{\psi}=M_{ij}\ket{\psi}$ and
$B_{i}M_{ij}\ket{\psi}=-A_{i}\ket{\psi}$ from Eq. (III.2). Further, we find
the following relation

$\displaystyle\\{A_{i},B_{i}\\}B_{j}\ket{\psi}=(A_{i}A_{k}+B_{i}B_{k})\ket{\psi}=0$

using $B_{i}B_{j}\ket{\psi}=A_{k}\ket{\psi}$,
$B_{k}A_{i}B_{j}\ket{\psi}=\ket{\psi}$,
$A_{j}A_{i}A_{k}\ket{\psi}=-\ket{\psi}$, and
$A_{j}B_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (18)-(19); and lastly,

$\displaystyle\\{A_{i},B_{i}\\}A_{i}B_{i}\ket{\psi}=(-A_{i}B_{i}B_{i}A_{i}+B_{i}A_{i}A_{i}B_{i})\ket{\psi}=0$

follows using $A_{i}B_{i}\ket{\psi}=-B_{i}A_{i}\ket{\psi}$ from Eq. (III.2).
Then for $\\{A_{k},M_{ij}\\}=0\in V_{3}$, we need to show the following
relations. We can prove following

$\displaystyle\\{A_{k},M_{ij}\\}A_{k}\ket{\psi}=(-A_{k}B_{k}+M_{ij})\ket{\psi}=0$

using $M_{ij}A_{k}\ket{\psi}=-B_{k}\ket{\psi}$ and
$A_{k}B_{k}\ket{\psi}=M_{ij}\ket{\psi}$ from Eq. (III.2). Next one is

$\displaystyle\\{A_{k},M_{ij}\\}A_{i}\ket{\psi}=(A_{k}A_{j}B_{k}-M_{ij}A_{j})=(A_{k}B_{i}-A_{i}B_{k})\ket{\psi}=0$

using $B_{k}A_{j}M_{ij}A_{i}\ket{\psi}=\ket{\psi}$,
$A_{j}A_{k}A_{i}\ket{\psi}=-\ket{\psi}$,
$B_{i}A_{j}B_{k}\ket{\psi}=\ket{\psi}$,
$B_{k}A_{i}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$, and
$B_{j}A_{k}B_{i}\ket{\psi}=B_{j}A_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq.
(17)-(19). Then, we show the following holds

$\displaystyle\\{A_{k},M_{ij}\\}B_{k}\ket{\psi}=(A_{k}A_{j}A_{i}+M_{ij}M_{ij})\ket{\psi}=0$

utilizing $A_{i}A_{j}M_{ij}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (17),
$A_{k}A_{j}A_{i}\ket{\psi}=-\ket{\psi}$ from Eq. (19) and
$A_{k}B_{k}\ket{\psi}=M_{ij}$ from Eq. (III.2). Further, we show

$\displaystyle\\{A_{k},M_{ij}\\}B_{i}\ket{\psi}=(A_{k}A_{i}+M_{ij}B_{j})\ket{\psi}=(-A_{j}+A_{j})\ket{\psi}=0$

using $M_{ij}B_{i}\ket{\psi}=A_{i}\ket{\psi}$,
$M_{ij}B_{j}\ket{\psi}=A_{j}\ket{\psi}$ from Eq. (III.2),
$B_{j}A_{k}B_{i}\ket{\psi}=\ket{\psi}$ from Eq. (18),
$A_{j}A_{i}A_{k}\ket{\psi}=-\ket{\psi}$ from Eq. (19); and lastly,

$\displaystyle\\{A_{k},M_{ij}\\}M_{ij}\ket{\psi}=(A_{k}+M_{ij}B_{k})\ket{\psi}=(-A_{i}A_{j}+A_{i}A_{j})\ket{\psi}=0$

using $A_{k}M_{ij}\ket{\psi}=B_{k}\ket{\psi}$ from Eq. (III.2),
$A_{j}A_{i}A_{k}\ket{\psi}=-\ket{\psi}$ from Eq. (19) and
$A_{j}A_{i}M_{ij}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (17). Next for
$\\{B_{i},M_{ij}\\}=0\in V_{3}$, we can show

$\displaystyle\\{B_{i},M_{ij}\\}A_{i}\ket{\psi}=(B_{i}A_{j}B_{k}-M_{ij}M_{jk})\ket{\psi}=0$

by using $B_{k}A_{j}M_{ij}A_{i}\ket{\psi}=\ket{\psi}$ and
$B_{i}A_{i}\ket{\psi}=-M_{ij}\ket{\psi}$ from Eq. (III.2),
$B_{j}A_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (18) and
$M_{ij}M_{jk}\ket{\psi}=\ket{\psi}$ from Eq. (20);

$\displaystyle\\{B_{i},M_{ij}\\}A_{j}\ket{\psi}=(B_{i}A_{i}B_{k}+M_{ij}B_{k})\ket{\psi}=(B_{i}B_{j}+A_{i}A_{j})\ket{\psi}=0$

using $B_{k}A_{i}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$,
$B_{k}B_{i}A_{j}\ket{\psi}=\ket{\psi}$,
$B_{j}A_{i}B_{k}\ket{\psi}=\ket{\psi}$,
$A_{j}A_{i}M_{ij}B_{k}\ket{\psi}=\ket{\psi}$,
$A_{k}B_{i}B_{j}\ket{\psi}=\ket{\psi}$, and
$A_{k}A_{i}A_{j}\ket{\psi}=-\ket{\psi}$ from Eq. (17)-(19);

$\displaystyle\\{B_{i},M_{ij}\\}A_{k}\ket{\psi}=(-B_{i}B_{k}+M_{ij}B_{j})\ket{\psi}=(-A_{j}+A_{j})\ket{\psi}=0$

utilizing $M_{ij}A_{k}\ket{\psi}=-B_{k}\ket{\psi}$,
$M_{ij}B_{j}\ket{\psi}=A_{j}\ket{\psi}$ from Eq. (III.2),
$B_{j}B_{i}A_{k}\ket{\psi}=\ket{\psi}$, and
$A_{j}B_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (18);

$\displaystyle\\{B_{i},M_{ij}\\}B_{i}\ket{\psi}=(B_{i}A_{i}+M_{ij})\ket{\psi}=0$

using $M_{ij}B_{i}\ket{\psi}=A_{i}\ket{\psi}$ and
$B_{i}A_{i}\ket{\psi}=-M_{ij}\ket{\psi}$ from Eq. (III.2);

$\displaystyle\\{B_{i},M_{ij}\\}B_{j}\ket{\psi}=(B_{i}A_{j}+M_{ij}A_{k})\ket{\psi}=(B_{k}-B_{k})\ket{\psi}=0$

by using $M_{ij}B_{j}\ket{\psi}=A_{j}\ket{\psi}$,
$M_{ij}A_{k}\ket{\psi}=-B_{k}\ket{\psi}$ from Eq. (III.2),
$A_{k}B_{i}B_{j}\ket{\psi}=\ket{\psi}$ and
$B_{k}B_{i}A_{j}\ket{\psi}=\ket{\psi}$ from Eq. (18);

$\displaystyle\\{B_{i},M_{ij}\\}B_{k}\ket{\psi}=(B_{i}A_{i}A_{j}+M_{ij}A_{j})\ket{\psi}=(-B_{i}A_{k}+A_{i}B_{k})\ket{\psi}=0$

utilizing $A_{j}A_{i}M_{ij}B_{k}\ket{\psi}=\ket{\psi}$,
$A_{j}B_{i}B_{k}\ket{\psi}=\ket{\psi}$,
$A_{k}A_{i}A_{j}\ket{\psi}=\ket{\psi}$,
$B_{k}A_{i}M_{ij}A_{j}\ket{\psi}=\ket{\psi}$,
$B_{j}B_{i}A_{k}\ket{\psi}=\ket{\psi}$, and
$B_{j}A_{i}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (17)-(19); and lastly,

$\displaystyle\\{B_{i},M_{ij}\\}M_{ij}\ket{\psi}=(B_{i}+M_{ij}A_{i})\ket{\psi}=(B_{i}+A_{j}B_{k})\ket{\psi}=0$

using $B_{i}M_{ij}\ket{\psi}=A_{i}\ket{\psi}$ from Eq. (III.2),
$B_{k}A_{j}M_{ij}A_{i}\ket{\psi}=\ket{\psi}$ and
$B_{i}A_{j}B_{k}\ket{\psi}=\ket{\psi}$ from Eq. (17)-(18).

Finally, we notice that a proof for $\\{B_{j},M_{ij}\\}=0$ $\in V_{3}$ holds
similarly to $\\{B_{i},M_{ij}\\}=0$. $\sqcap$$\sqcup$

##  Appendix C Invariant subspace, commutation and anti-commutation relations
for hatted operators in $n$-qubit scenario

The proof of Lemma 9.– We have the following by using $A_{1}B_{2}\ldots
B_{n}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1) and
$B_{i}A_{i}\ket{\psi}=-N_{ij}\ket{\psi}$ from Eq. (IV.2),

$\displaystyle B_{1}\ldots
B_{n}\ket{\psi}=B_{1}A_{1}\ket{\psi}=-N_{ij}\ket{\psi}.$ (57)

Then, by using $A_{k}\prod_{i_{j}\neq k}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$
from Eq. (IV.2), we also have the following relations,

$\displaystyle\prod_{i_{j}\neq k}^{n}B_{i_{j}}\ket{\psi}=A_{k}\ket{\psi}.$
(58)

These two identities are crucial for the proof of the lemma. We will consider
the different cases separately as follows.

Action of $B_{m}$ on $V_{n}$: Let us first consider the following different
cases when $B_{m}$ acts on on $B_{i_{1}}B_{i_{2}}\ldots B_{i_{k}}\ket{\psi}$.
Using relation $B_{1}\ldots B_{i-1}A_{i}B_{i+1}\ldots
B_{n}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1), we find

$\displaystyle B_{m}B_{i_{1}}B_{i_{2}}\ldots
B_{i_{k}}\ket{\psi}=(B_{m}B_{i_{j}})B_{i_{1}}B_{i_{2}}\ldots
B_{i_{k}}\ket{\psi},$

where $m=i_{j}$ for $j\in[1,k]$ and $k\in[1,n-1]$. Then we notice the
following hold for $k=n$,

$\displaystyle B_{m}B_{1}\ldots
B_{n}\ket{\psi}=-B_{m}N_{jm}\ket{\psi}=A_{m}\ket{\psi}=\prod_{i_{j}\neq
m}^{n}B_{i_{j}}\ket{\psi},$

where the first equality comes from Eq. (57). The second and last equality
comes from $B_{m}N_{jm}\ket{\psi}=-A_{m}\ket{\psi}$ (Eq. IV.2) and
$A_{m}\prod_{i_{j}=1,i_{j}\neq m}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ (Eq.
IV.1) respectively. Thus, $B_{m}$ keeps the state in $V_{n}$ for $m=i_{j}$.
Now, for the cases with $m\neq i_{j}$ where $j\in[1,k]$, first, we consider
$k\in[1,n-2]$, and find that the following hold,

$\displaystyle B_{m}B_{i_{1}}B_{i_{2}}\ldots
B_{i_{k}}\ket{\psi}=B_{i_{1}}B_{i_{2}}\ldots B_{i_{j-1}}B_{m}B_{i_{j+1}}\ldots
B_{i_{k}}\ket{\psi}\quad{\rm for}\quad i_{j-1}<m<i_{j+1},$

where we used the fact that $B_{i_{1}}B_{i_{2}}\ldots
B_{i_{j-1}}B_{m}B_{i_{j+1}}\ldots B_{i_{k}}\ket{\psi}$ is equivalent to
$B_{m}B_{i_{1}}B_{i_{2}}\ldots B_{i_{k}}\ket{\psi}$ under permutation from Eq.
(IV.1). The last case for $k=n-1$, we show

$\displaystyle B_{m}\prod_{i_{j}\neq
m}^{n}B_{i_{j}}\ket{\psi}=B_{m}A_{m}\ket{\psi}=B_{1}A_{1}\ket{\psi}=B_{1}\ldots
B_{n}\ket{\psi},$

where we get the first equality from (58), then used
$B_{m}A_{m}\ket{\psi}=B_{1}A_{1}\ket{\psi}=N_{ij}\ket{\psi}$ from Eq. (IV.2)
and $A_{1}B_{2}\ldots B_{n}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1) for
immediate steps. Thus the subspace $V_{n}$ is invariant under the action of
$B_{m}$ operators for any $m\in[1,n]$.

Action of $A_{m}$ on $V_{n}$: We consider the action of $A_{m}$ operators on
$B_{i_{1}}B_{i_{2}}\ldots B_{i_{k}}\ket{\psi}$ in different cases. For the
cases with $m=i_{j}$ where $j\in[1,k]$ and $k\in[1,n-1]$, we find

$\displaystyle A_{m}B_{i_{1}}B_{i_{2}}\ldots B_{i_{j}}\ldots
B_{i_{k}}\ket{\psi}=A_{m}A_{j^{\prime}}\mathcal{B}_{j^{\prime}}\ket{\psi},$

where $\prod_{i_{j^{\prime}}\neq
j^{\prime},m,i_{j}}^{n}B_{i_{j^{\prime}}}=\mathcal{B}_{j^{\prime}}$. We get
above relation using permutations of $B_{1}\ldots B_{i-1}A_{i}B_{i+1}\ldots
B_{n}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1) by moving the operators
$A_{j^{\prime}}$ and $A_{m}$ towards the right. Then, for $k=n$, we get

$\displaystyle A_{m}B_{1}\ldots
B_{n}\ket{\psi}=-A_{m}N_{jk}\ket{\psi}=-A_{m}A_{m}B_{m}\ket{\psi}=-B_{m}\ket{\psi},$

where the first equality follows from Eq. (57) and last one using
$N_{jk}\ket{\psi}=A_{m}B_{m}\ket{\psi}$ from Eq. (IV.2). Lastly, for $m\neq
i_{j}$ with $j\in[1,k]$ and $k\in[1,n-1]$, we show the following

$\displaystyle A_{m}B_{i_{1}}B_{i_{2}}\ldots
B_{i_{k}}\ket{\psi}=\prod_{i_{j^{\prime}}\neq
m,i_{j}}^{n}B_{i_{j^{\prime}}}\ket{\psi},$

where we used the various permutations of $A_{m}B_{i_{1}}\ldots
B_{i_{n}}\ket{\psi}=\ket{\psi}$ from Eq. (IV.2). Therefore $A_{m}$ keeps
$V_{n}$ invariant.

Action of $N_{lm}$ on $V_{n}$: Finally, we will consider the action of
$N_{lm}$ operators on $B_{i_{1}}B_{i_{2}}\ldots B_{i_{k}}\ket{\psi}$ in
different cases. Let us assume $l,m\neq i_{j}$ with $j\in[1,k]$ and
$k\in\\{1,n-2\\}$, then we have

$\displaystyle N_{lm}B_{i_{1}}B_{i_{2}}\ldots
B_{i_{k}}\ket{\psi}=A_{j^{\prime}}A_{m}\mathcal{B}_{j^{\prime}}\ket{\psi},$

using the permutations of the identity
$A_{m}A_{j^{\prime}}N_{lm}\mathcal{B}_{j^{\prime}}\ket{\psi}=\ket{\psi}$ from
Eq. (IV.1). And, whenever $(l=i_{j},m\neq i_{j})$ or $(m=i_{j},l\neq i_{j})$
for $k=[1,n-2]$, we find

$\displaystyle N_{lm}B_{i_{1}}\ldots
B_{i_{k}}\ket{\psi}=N_{lm}B_{i_{1^{\prime}}}\ldots
B_{i_{k^{\prime}}}A_{m}\ket{\psi}=N_{lm}N_{lm}B_{i_{1}}\ldots
B_{i_{k}}A_{l}\ket{\psi},$

where using the permutations of the identity $\prod_{i_{j}\neq
m}^{n}B_{i_{j}}A_{m}\ket{\psi}=\ket{\psi}$ s.t., $i_{j^{\prime}}\neq i_{j}$,
and the identity $N_{lm}A_{m}A_{l}\prod_{i_{j}\neq
m,l}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1). Now, the scenario
when both $l$ and $m$ are equal to one of the $i_{j}$’s with $k=\\{1,n-2\\}$,
we find

$\displaystyle N_{lm}B_{i_{1}}\ldots
B_{i_{k}}\ket{\psi}=N_{lm}B_{i_{1^{\prime}}}\ldots
B_{i_{k^{\prime}}}A_{i_{k^{\prime}+1}}\ket{\psi}=-N_{lm}\prod_{i_{j}\neq
l,m,k^{\prime}+1,i_{j^{\prime}}}^{n}B_{i_{j}}A_{l}A_{m}\ket{\psi}=-N_{lm}N_{lm}\mathcal{B}_{j^{\prime}}\ket{\psi}.$

using the permutations of the identity $\prod_{i_{s}\neq
k^{\prime}+1}^{n}B_{i_{s}}A_{k^{\prime}+1}\ket{\psi}=\ket{\psi}$, then
$\prod_{i_{s}\neq
k^{\prime}+1,l,m}^{n}B_{i_{s}}A_{k^{\prime}+1}A_{l}A_{m}\ket{\psi}=-\ket{\psi}$
from Eq. (IV.1) and the permutations of $N_{lm}\prod_{i_{s}\neq
l,m}^{n}B_{i_{s}}A_{l}A_{m}\ket{\psi}=\ket{\psi}$ from Eq. (IV.2). Next, we
get from Eq. (58)

$\displaystyle N_{lm}A_{k}\ket{\psi}=-B_{k}\ket{\psi},\quad k\neq l,m;\>\>{\rm
and}\>\>N_{lm}A_{l}\ket{\psi}=A_{m}\prod_{i_{j}\neq
l,m}^{n}B_{i_{j}}\ket{\psi},$

by using the identity from Eq. (IV.2) for the first equality and the
permutations of $N_{lm}A_{m}A_{l}\prod_{i_{j}\neq
m,l}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1) for the second one.
Lastly, using Eq. (IV.2) in Eq. (57) we find
$N_{lm}N_{ij}\ket{\psi}=\ket{\psi}$, where $i,j$ can be the same or different
from $l,m$. Thus, $N_{lm}$ keeps $V_{n}$ invariant. $\sqcap$$\sqcup$

The proof of Lemma 10.– Similar to the proof of Lemma 4, we can show that the
commutators of unhatted operators vanish on all the subspace elements. Again
if the operators $A,B,N$ appear together in inequality (IV.2), seeing
$[A,B]N\ket{\psi}=N[A,B]\ket{\psi}$ holds, we ignore such scenarios in the
$n$-qubit case also. We consider $[A_{l},A_{m}]$ acting on $V_{n}$, for a
demonstration, the remaining commutators can be proven similar to the Lemma 4.

For $(l=i_{j},m\neq i_{j})$ or $(m=i_{j},l\neq i_{j})$ with $j\in[1,k]$ and
$k\leq n-1$, we find using $A_{m}\prod_{i_{j}\neq
m}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1),

$\displaystyle[A_{l},A_{m}]\prod_{i_{j}=1}^{n}B_{i_{j}}\ket{\psi}=\left(A_{l}\prod_{i_{j^{\prime}}\neq
l,m,i_{j}}^{n}B_{i_{j^{\prime}}}-A_{m}A_{l}A_{m}\prod_{i_{j^{\prime}}\neq
i_{j},l,m}^{n}B_{i_{j^{\prime}}}\right)\ket{\psi}=\left(A_{l}\prod_{i_{j^{\prime}}\neq
l,m,i_{j}}^{n}B_{i_{j^{\prime}}}-A_{m}N_{lm}\prod_{i_{j}\neq
l,m}^{n}B_{i_{j}}\right)\ket{\psi},$

where the second equality comes from $A_{l}A_{m}N_{lm}\prod_{i_{j}\neq
l,m}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ using Eq. (IV.1). When both $l,m$ are
equal to some $i_{j}$ we have

$\displaystyle[A_{l},A_{m}]\prod_{i_{j}=1}^{n}B_{i_{j}}\ket{\psi}=\left(A_{l}A_{m}A_{m^{\prime}}\prod_{i_{j^{\prime}}\neq
l,m,m^{\prime},i_{j}}^{n}B_{i_{j^{\prime}}}-A_{m}A_{l}A_{m^{\prime}}\prod_{i_{j^{\prime}}\neq
l,m,m^{\prime},i_{j}}^{n}B_{i_{j^{\prime}}}\right)\ket{\psi}=0,$

using $A_{m^{\prime}}\prod_{i_{j}\neq
m^{\prime}}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$, and the permutations of
$A_{l}A_{m}A_{m^{\prime}}\prod_{i_{j}\neq
l,m,m^{\prime}}^{n}B_{i_{j}}\ket{\psi}=-\ket{\psi}$ from Eq. (IV.1).
Therefore, $[\hat{A}_{l},\hat{A}_{m}]=0$ $\in V_{n}$. $\sqcap$$\sqcup$

The proof of Lemma 11.– For the anti-commutators, we will show the proof for
$\\{A_{i},B_{i}\\}$ for a demonstration, and the remaining follows similar to
Lemma 5.

Using $A_{j}\ket{\psi}$ from Eq. (58) for $i=j$, we have
$\\{A_{i},B_{i}\\}A_{i}\ket{\psi}=(A_{i}N_{jk}+B_{i})\ket{\psi}=0$ by using
$B_{i}A_{i}\ket{\psi}=-N_{jk}\ket{\psi}$ from Eq. (IV.2) twice. Similarly, for
$i\neq j$, we have

$\displaystyle\\{A_{i},B_{i}\\}A_{j}\ket{\psi}=\left(A_{i}B_{k}\prod_{i_{j}\neq
i,j,k}^{n}B_{i_{j}}-B_{i}A_{k}\prod_{i_{j}\neq
i,j,k}^{n}B_{i_{j}}\right)\ket{\psi}=0,$

using $\prod_{i_{j}\neq
i,j,k}^{n}B_{i_{j}}B_{i}A_{j}B_{k}\ket{\psi}=\ket{\psi}$, $\prod_{i_{j}\neq
i,j,k}^{n}B_{i_{j}}A_{i}A_{j}A_{k}\ket{\psi}=-\ket{\psi}$ and
$\prod_{i_{j}\neq
i,j,k}^{n}B_{i_{j}}A_{i}B_{k}B_{j}\ket{\psi}=\prod_{i_{j}\neq
i,j,k}^{n}B_{i_{j}}B_{i}A_{k}B_{j}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1).
Then, using Eq. (57) and $A_{i}B_{i}\ket{\psi}=-B_{i}A_{i}\ket{\psi}$ from Eq.
(IV.2), we have

$\displaystyle-\\{A_{i},B_{i}\\}B_{i}A_{i}\ket{\psi}=(-\ket{\psi}-B_{i}A_{i}B_{i}A_{i})\ket{\psi}=(-\ket{\psi}+\ket{\psi})=0.$

Note that the following two cases don’t appear in the case of Lemma 5, and
therefore, we consider them to complete the proof. Considering a state of the
form $\prod_{j=1}^{k}B_{i_{j}}\ket{\psi}$ with $k\in[1,n-2]$, we have

$\displaystyle\\{A_{i},B_{i}\\}\prod_{i_{j}=1}^{n}B_{i_{j}}\ket{\psi}=\left(A_{i}\prod_{i_{j}\neq
i}^{n}B_{i_{j}}+B_{i}A_{i}A_{k}\prod_{i_{j^{\prime}}\neq
i,k,i_{j}}^{n}B_{i_{j^{\prime}}}\right)\ket{\psi}=\left(\prod_{i_{j^{\prime}}\neq
i,l,i_{j}}^{n}B_{i_{j^{\prime}}}-B_{i}A_{l}\prod_{i_{j}\neq
i,k,i_{j^{\prime}}}^{n}B_{i_{j}}\right)\ket{\psi}=0,$

where $i=i_{j}$ and we use the permutations of $A_{k}\prod_{i_{j}\neq
k}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$, $A_{i}\prod_{i_{j}\neq
i}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$, $A_{i}A_{k}A_{l}\prod_{i_{j}\neq
i,k,l}^{n}B_{i_{j}}\ket{\psi}=-\ket{\psi}$ and $A_{l}\prod_{i_{j}\neq
l}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ from Eq. (IV.1). Lastly, we find the
below relation on the same state with $i\neq i_{j}$

$\displaystyle\\{A_{i},B_{i}\\}\prod_{i_{j}=1}^{n}B_{i_{j}}\ket{\psi}=\left(A_{i}A_{k}\prod_{i_{j^{\prime}}\neq
i,k,i_{j}}^{n}B_{i_{j^{\prime}}}+\prod_{i_{j^{\prime}}\neq
i_{j}}^{n}B_{i_{j^{\prime}}}\right)\ket{\psi}=\left(-A_{l}\prod_{i_{j}\neq
i,k,l,i_{j^{\prime}}}^{n}B_{i_{j}}+\prod_{i_{j^{\prime}}\neq
i_{j}}^{n}B_{i_{j^{\prime}}}\right)\ket{\psi}=0,$

using the fact that $A_{k}\prod_{i_{j}\neq
k}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$, $A_{i}\prod_{i_{j}\neq
i}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$, the permutations of
$A_{i}A_{k}A_{l}\prod_{i_{j}\neq i,k,l}^{n}B_{i_{j}}\ket{\psi}=-\ket{\psi}$,
and $A_{l}\prod_{i_{j}\neq l}^{n}B_{i_{j}}\ket{\psi}=\ket{\psi}$ from Eq.
(IV.1). $\sqcap$$\sqcup$