Secure State Estimation of Cyber-Physical Systems via Gaussian Bernoulli Mixture Model

Extracted source text · arXiv 2411.09956

% autosam.tex
% Annotated sample file for the preparation of LaTeX files
% for the final versions of papers submitted to or accepted for
% publication in AUTOMATICA.

% See also the Information for Authors.

% Make sure that the zip file that you send contains all the
% files, including the files for the figures and the bib file.

% Output produced with the elsart style file does not imitate the
% AUTOMATICA style. The style file is generic for all Elsevier
% journals and the output is laid out for easy copy editing. The
% final document is produced from the source file in the
% AUTOMATICA style at Elsevier.

% You may use the style file autart.cls to obtain a two-column
% document (see below) that more or less imitates the printed
% Automatica style. This may helpful to improve the formatting
% of the equations, tables and figures, and also serves to check
% whether the paper satisfies the length requirements.

% Please note: Authors must not create their own macros.

% For further information regarding the preparation of LaTeX files
% for Elsevier, please refer to the "Full Instructions to Authors"
% from Elsevier's anonymous ftp server on ftp.elsevier.nl in the
% directory pub/styles, or from the internet (CTAN sites) on
% ftp.shsu.edu, ftp.dante.de and ftp.tex.ac.uk in the directory
% tex-archive/macros/latex/contrib/supported/elsevier.


%\documentclass{elsart}               % The use of LaTeX2e is preferred.

\documentclass[twocolumn]{autart}    % Enable this line and disable the
                                     % preceding line to obtain a \usepackage{algorithmic,algorithm}                                 \usepackage{algorithmic,algorithm}
%
%\usepackage{xcolor}
%
%\usepackage{cite}
%
%\usepackage{graphicx}
%
%\usepackage{epstopdf}
%\usepackage{amsmath}
%\usepackage{float}
%
%\usepackage{subfigure}
%\usepackage{amssymb}
%\usepackage{CJK}
%\usepackage{algorithm}
%\usepackage{algorithmic}


%\usepackage[comma,numbers,square,sort&compress]{natbib}
%\usepackage{natbib}
\usepackage{amsfonts}
\usepackage{textcomp}
\usepackage{enumerate}
\usepackage{cite}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{algorithm}
% \usepackage{algorithmic}
\usepackage{algpseudocode}
\usepackage{bbm}
\usepackage{graphics}
\usepackage{epsfig}
\usepackage{multicol} % Used for the two-column layout of the document
\usepackage{stfloats}
%\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
  %  T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\usepackage{appendix}
\usepackage{amsmath}
\usepackage[table]{xcolor} 
\usepackage{subcaption}
\usepackage{placeins}
\usepackage{url}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{wrapfig}


\newtheorem{theorem}{Theorem}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
%\newtheorem{proof}{Proof}
\newtheorem{property}{Property}
\newtheorem{corollary}{Corollary}
\newtheorem{example}{Example}
\newtheorem{remark}{Remark}
\newtheorem{definition}{Definition}
\newtheorem{assumption}{Assumption}
% \newenvironment{proof}{\hspace{0ex}\textsc{Proof}.\hspace{1ex}}{\hfill$\Box$\newline}
\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother                                   % two-column
                                     % document whose style resembles the
                                     % printed Automatica style}

%\usepackage
        % Include this line if your
                               % document contains figures,
%\usepackage[dvips]{epsfig}    % or this line, depending on which
                               % you prefer.

\begin{document}

\begin{frontmatter}
%\runtitle{Insert a suggested running title}  % Running title for regular
                                              % papers but only if the title
                                              % is over 5 words. Running title
                                              % is not shown in output.

\title{Secure State Estimation of Cyber-Physical Systems via  Gaussian Bernoulli Mixture Model} % Title, preferably not more
                                                % than 10 words.



\author[address_a]{Xingzhou~Chen},~
\author[address_a]{Nachuan~Yang},~
\author[address_c]{Peihu~Duan},~
\author[address_d]{Shilei~Li}$^\dagger$,~
\author[address_a,address_e]{Ling~Shi}



\address[address_a]{Department of Electronic and Computer Engineering, The Hong Kong University of Science and Technology,\\
Clear Water
Bay, Kowloon, Hong Kong, China}

\address[address_c]{State Key Laboratory of CNS/ATM, Beijing Institute of Technology, Beijing 100081, China}

\address[address_d]{School of Automation, Beijing Institute of Technology, Beijing 100081, China}

\address[address_e]{Department of Chemical and Biological Engineering, The Hong Kong University of Science and Technology,\\Clear Water Bay, Kowloon, Hong Kong, China}


\begin{keyword}           % Five to ten keywords,
Cyber physical systems, Attack detection, Resilient estimation, State sequence estimation, Partial observation.
\end{keyword}


\begin{abstract}
The implementation of cyber-physical systems in real-world applications is challenged by safety requirements in the presence of sensor threats. Most cyber-physical systems, especially multi-sensor systems, struggle to detect sensor attacks when the attack model is unknown. In this paper, we tackle this issue by proposing a Gaussian-Bernoulli Secure (GBS) estimator, which transforms the detection problem into an optimal estimation problem concerning the system state and observation indicators. It encompasses two theoretical sub-problems: sequential state estimation with partial observations and estimation updates with disordered new observations. Within the framework of Kalman filter, we derive closed-form solutions for these two problems. However, due to their computational inefficiency, we propose the iterative approach employing proximal gradient descent to update the estimation in less time. Finally, we conduct experiments from three perspectives: computational efficiency, detection performance, and estimation error. Our GBS estimator demonstrates significant improvements over other methods.

\end{abstract}

\end{frontmatter}

\input{introduction}
\input{body/theorem} % 1.5 page
\input{body/problem} % 1.5 page
\input{body/intermediate} % 1.5 page
\input{body/algorithm} % 1.5 page
\input{body/experiment} %1 page
\input{conclusion}
\input{appendix}

\bibliographystyle{unsrt}
\bibliography{ref}
\end{document}

\section{Introduction}
Cyber-Physical Systems (CPSs) are integrative frameworks that combine computing and communication capabilities to monitor or control entities within the physical world~\cite{giraldo2018survey,jensen2011model,zhou2024cybersecurity}. Over the past two decades, significant advancements in communication and computing technologies have catalyzed the wide applications for CPSs~\cite{chen2017applications}. The advancement in wireless communication technologies has enabled CPSs to transmit real-time signals across expansive physical networks~\cite{yu2016smart}. Furthermore, armed with advanced computational resources, CPS can optimize control strategies for complex systems online in real-time~\cite{zhang2022advancements}. This technological evolution broadens the scope of CPSs, impacting various sectors such as robot manipulators~\cite{ren2025high}, smart grids~\cite{he2016cyber}, and autonomous vehicles~\cite{kim2021cybersecurity}, to name just a few.

However, alongside the opportunities, CPSs face significant challenges, with security issues emerging as a paramount concern. A notable incident underscoring this concern involves the RQ-170, an American drone~\cite{ruegamer2015jamming}\cite{hartmann2013vulnerability}, which lost control in Iran due to a security breach. This security breach was executed through the manipulation of the drone's GPS signal, causing the UAV to land in a strategically targeted area. The reliance of many CPSs on remote signal transmission over vulnerable networks opens them up to sensory attacks. These attacks, through the injection of malicious data~\cite{mo2010false} or disruption of information transmission~\cite{ren2024optimal}, can significantly degrade a system's performance, e.g., maximizing the estimation error covariance~\cite{guo2016optimal}, amplifying the expected estimation error~\cite{zhang2015optimal1}. 

Against various sensory attacks, two types of detection methods are widely studied. One is the model-based defense mechanisms, e.g., control theory, game theory and cryptography. Detectors based on linear estimation theory, which analyze the Kalman innovation sequence, are widely applied in CPS, especially windows $\chi^2$ detector~\cite{mo2013detecting}, interval anomaly detector~\cite{zhou2023optimal} and LASSO-based detector~\cite{yang2023lasso}, to name just a few. The framework of game theory also enables the design of the optimal defense policies. For instance, Basar et al.~\cite{zhu2015game} considered the system balance between resilience and robustness, Li et al.~\cite{li2016sinr} obtained the optimal DoS defense strategy by solving the associated Bellman equations, and Meira-G{\'o}es et al.~\cite{meira2021synthesis} improved the efficiency of synthesized robust supervisors against sensor deception attacks. Fu et al proposed a distributed secure filtering method against eavesdropping attacks in SINR-based sensor networks \cite{fu2024distributed}. Additionally, with the idea of cryptography, Mo et al.~\cite{mo2015physical2} proposed the watermarking approach to authenticate the correct operation of a control system, while Kogiso et al.~\cite{kogiso2015cyber} incorporated the public key encryption scheme into the design of remote controller or observers. The encryption-based secure method is further discussed in \cite{shang2020optimal, shang2022single,shang2025stealthy}. Another strategy involves using data-driven methods to identify CPS attacks. The graph neural network (GNN) approach proposed in \cite{lin2018tabor} provided a solution for interpretation and localization of anomalies in secure water treatment, overcoming the challenges of high dimensionality and complexity. Besides, LSTM-RNNs were applied in \cite{goh2017anomaly} for learning the temporal behaviour of the data in CPSs and identifying sensor anomalies. Moreover, Wang et al.~\cite{wang2019deep} utilized Deep Belief Network (DBF) to train an interval state predictor for pattern recognition in sensor security. Reinforcement learning methods have also been utilized in online detection and mitigation of CPS attacks \cite{koley2021catch}.

Apart from detecting attacks, designing resilient state estimators played a critical role in mitigating sensor attacks. Mo et al.~\cite{mo2014secure} studied the case of multiple measurements subject to sensor attacks, designing an optimal estimator by solving a minimax optimization problem. In addition, regarding secure estimation problem in  noiseless systems, Chang et al.~\cite{chang2018secure} formulated it as the classical error correction problem and provided the sufficient conditions for restoring the real states. Furthermore, Wang et al.~\cite{wang2018robust} considered attacked sensor signals as general outliers, obtaining resilient estimates by identifying and eliminating these outliers. The resilient method is also studied in the consensus of multi-agent systems \cite{wen2023joint} and distributed estimation \cite{li2024secure}. Previous detecting methods have two limitations. First, attack detectors and resilient state estimators are interdependently designed and the connection between them are overlooked. It is challenging to ensure the estimation performance while simultaneously detecting attacks. Second, occasional outliers and malicious attacks are difficult to distinguish, as their Kalman innovation sequences may overlap. If we can separate these outliers from observations, the binary detection problem will become more accurate, thereby reducing the false alarm rate.

To overcome these shortcomings, we initiatively formulate the potential anomalies and normal Gaussian noise as a Gaussian-Bernoulli mixture model by introducing observation indicators. By solving a dual-variable estimation problem, our proposed algorithm can simultaneously achieves resilient state estimation and attack detection. The main contributions of this article include:
\begin{enumerate}
    \item In the absence of knowledge about the attack model, we introduce the Gaussian-Bernoulli mixture model to represent the observation model. Under this mixture model, we propose a novel framework to integrate the attack detection and resilient estimation into an optimal estimation problem with dual variables.
    \item Within the framework of Kalman filter and RTS smoother, we derive analytical solutions for two subproblems: sequential state estimation with partial observations and estimation update with disordered new observations.
    \item We propose an innovative iterative method that addresses the challenge of non-sequential observation changes. By using the previous estimation as the initial point, our algorithm utilizes proximal gradient descent to accelerate convergence to the optimal estimation under the new observations.
    \item We test the performance of the GBS estimator without any attacker information, across different types and intensities of attacks. The simulations show that it significantly outperforms previous methods in both detection and estimation performance.
\end{enumerate}

The remainder of the paper is organized as follows. In Section II, we introduce the linear estimation as an application of Bayesian theory in Hidden Markov Chains. In Section III, we describe the model assumptions and the problem we aim to solve. In Sections IV and V, we discuss the core step of our algorithm: updating the state sequence estimation in response to disordered changes in the observation set. In Section VI, we propose our Gaussian-Bernoulli secure estimator and prove its convergence. In Section VII, we demonstrate our algorithm's performance and compare it with other algorithms. In Section VIII, we conclude the paper. For clarity, this paper focuses on the single-sensor system, but the derivation process and conclusions are also applicable to multi-sensor systems. 

\textbf{Notation:} For $S\in R^{n \times n}, S\succ 0$, let $\|x\|_{S} = \sqrt{x^TSx} $ denoting the S-weighted 2-norm of $x$. Denote the state sequence at interval $T=[0,N]$ as $x_{0:N}=\{x_0,\cdots,x_N\}$. The observation set is denoted as $y_{0:N}=\{y_0,\cdots,y_N\}$. The observation indicators are denoted as $p_{0:N}=\{p_0,\cdots,p_N\}$. Let $\mathcal{O} \in 2^{\{0,\cdots,N\}}$ denotes the selected index set, and then $y_\mathcal{O}$ denotes the selected observation set. $\hat{x}_{i|\mathcal{O}}$ denotes the optimal estimation of the state $x_i$ under the observation set $y_{\mathcal{O}}$. Let symbol $\circ$ denoting the composition of functions.
\section{Bayesian Methods in HMMs}
This section introduces Bayesian estimation as tools for analyzing stochastic systems and estimating the states of a hidden Markov model (HMM). Furthermore, we present the steps of Kalman filter and RTS smoother, highlighting their optimality within our framework.

% \subsection{Hidden Markov model}
% The hidden Markov model is a standard stochastic process model, extensively used for analyzing sequences of random events in finance and engineering domains. HMM inherits the properties of the Markov process, but the states cannot be directly observed.

% \begin{figure}[htbp]
% \centering
% \includegraphics[width=0.35\textwidth]{figures/hmm.png}
% \caption{Illustration of a hidden Markov chain.}
% \end{figure}

% A Markov process is ``memorylessnes". This means, in such stochastic process, the future state of the process only depends on the current state and is independent of past states or the path taken. Mathematically, for any time $t$ and any states $s_1, s_2, \cdots, s_{t+1}$, it satisfies the following condition:
% $$ p(x_{t+1}=s_{t+1} | x_{t}=s_{t},\ldots) = p(x_{t+1}=s_{t+1} | x_{t}=s_{t}) $$
% where $p(x_{t+1}=s_{t+1}|x_{t}=s_t)$ describes the probability of transition from state $s_{t}$ to state $s_{t+1}$ at the next time point.

% In HMMs, the states of the system are pivotal, yet they are considered unobservable. Nonetheless, we can observe a sequence of observations $o_1,o_2,\cdots, o_{t+1}$ that are associated with these hidden states. Each observation correlates with a specific hidden state, where $p(y_t=o_t|x_t=s_t)$ represents the probability of observing the value $o_t$ given the state $s_t$. 

% The essence of HMM is how to reveal the underlying Markov process with the hidden system states by analyzing the associated observation sequence, thereby precisely characterizing the stochastic events in time series.

\subsection{Bayesian Estimation}
Bayesian estimation is a statistical inference method for updating the beliefs in presence of new evidence. This approach is particularly valuable when data is limited or uncertainty is high.  

At the core of Bayesian estimation is Bayes' theorem, which describes the relationship between conditional probabilities. The theorem can be expressed as:
$$p(x|y) = \frac{p(y|x)\cdot p(x)}{p(y)}, $$
where the prior probability $p(x)$ represents current knowledge before observation, the likelihood function $p(y|x)$ describes the known statistical model of observation given the state, and the posterior probability $p(x|y)$ updates probability of the state after observation.

\subsection{MMSE and MAP}
The Minimum Mean Squared Error (MMSE) and Maximum A Posteriori (MAP) are two classic Bayesian estimation methods, each with different probabilistic optimization objectives.

The goal of MMSE estimation is to minimize the mean squared error between the estimated values and the true values. Mathematically, the MMSE estimator can be expressed as:
\begin{align*}
    \hat{x}^{\text{MMSE}} = \arg \min_{\hat{x}} \mathbf{E}[
    \| x-\hat{x}\|^2 |y].
\end{align*}
Further, when the posterior distribution is symmetric without the heavy tail, the MMSE estimator is equal to the expectation under certain conditions, 
\begin{align*}
    \hat{x}^{\text{MMSE}} = \mathbf{E}[x|y] = \int x \cdot \frac{p(y|x)\cdot p(x)}{p(y)} dx.
\end{align*}
% The MMSE estimator focuses on minimizing the overall error, providing an estimate that performs best on average across all possible values. 
In contrast to the MMSE estimator, the MAP estimator aims to find the state value that maximizes the posterior probability. It means that given the observed data, we seek the state value most likely to produce these data. Mathematically, the MAP estimator can be expressed as:
\begin{align*}
    \hat{x}^{\text{MAP}} = \arg \max_{\hat{x}} p(\hat{x}|y) = \arg \max_{\hat{x}} \frac{p(y|\hat{x})\cdot p(\hat{x})}{p(y)}.
\end{align*}
% MAP estimator aims to determine the most probable parameter value, providing a more convicing estimate when the random variables are discrete.

\subsection{Kalman filter and RTS smoother} \label{sec:C}
The Kalman filter can be considered as a specific application of Bayesian estimation in HMMs. The uniqueness of the Kalman filter is reflected in three main aspects. 

First, both state transitions and observation processes are assumed to be linear and accompanied by Gaussian noise. They can be expressed as follows,
\begin{align*}
    x_{t+1} \sim \mathcal{N}(A{x}_t, Q), \\
    y_t \sim \mathcal{N}(C{x}_t, R),
\end{align*}
where $Q>0$ and $R>0$ denotes the process noise and the observation noise. 

% The probability density function of $\mathcal{N}(\mu,\Sigma)$ is given by the following formula
% \begin{align*}
%     p(x) \propto \exp\left(-\frac{1}{2}\|x-\mu\|^2_{\Sigma^{-1}}\right).
% \end{align*}

Additionally, the minimal estimation error obtained by MMSE has a linear relationship with the observation and process error. Therefore, given the system state $x_t \sim \mathcal{N}(\hat{x}_{t|t}^*,P_{t|t})$, when a new observation $y_{t+1}$ is made, the linear MMSE (LMMSE) estimator and MAP estimator will infer $\hat{x}_{t+1}$ and adjust $\hat{x}_{t}$ by solving different optimization problems.

\textbf{LMMSE}
\begin{equation*} 
\hat{x}^{\text{LMMSE}}_{t+1},K=
\begin{array}{cl} 
 \displaystyle  \arg &\min_{\hat{x}_{t+1},K}  
E[\|x_{t+1} - \hat{x}_{t+1}\|^2]  \\
 \textrm{s.t.} & \hat{x}_{t+1} = A\hat{x}_{t|t}^* +K(y_{t+1}-CA\hat{x}_{t|t}^*)  
\end{array} 
\end{equation*}
\begin{equation*} 
\hat{x}^{\text{LMMSE}}_{t},F=
\begin{array}{clll} 
 \displaystyle  \arg&\min_{\hat{x}_{t},F}  
E[\|x_{t} - \hat{x}_{t}\|^2]  \\
 \textrm{s.t.} &   \hat{x}_{t} = \hat{x}_{t|t}^* +F(\hat{x}^{\text{LMMSE}}_{t+1}-A\hat{x}_{t|t}^*)  
\end{array}
\end{equation*}
\textbf{MAP}
\begin{align*}
  \hat{x}^{\text{MAP}}_{t+1}, \hat{x}^{\text{MAP}}_{t} &= \arg \max_{\hat{x}_{t+1},\hat{x}_{t}} ~ p(\hat{x}_{t+1},\hat{x}_{t}|y_{t+1}) \\ 
  = \arg & \max_{\hat{x}_{t+1},\hat{x}_{t}} ~ p(y_{t+1}|\hat{x}_{t+1})p(\hat{x}_{t+1}|\hat{x}_{t})p(\hat{x}_{t}|x_{t}) \\
  = \arg & \min_{\hat{x}_{t+1},\hat{x}_{t}} ~ [\|y_{t+1}-C\hat{x}_{t+1}\|^2_{R^{-1}}+ \\
  & \|\hat{x}_{t+1}-A\hat{x}_{t}\|^2_{Q^{-1}} + \|\hat{x}_{t}-\hat{x}_{t|t}^*\|^2_{P_{t|t}^{-1}}]
\end{align*}
Moreover, LMMSE and MAP have the same result in linear Gaussian model. 
The closed-form solution of optimal estimate can be calculated by Kalman filter and Rauch-Tung-Striebel (RTS) smoother.
\begin{align*}
    \hat{x}_{t+1|t+1} = \hat{x}^{\text{LMMSE}}_{t+1} = \hat{x}^{\text{MAP}}_{t+1} \\
    \hat{x}_{t|t+1} = \hat{x}^{\text{LMMSE}}_{t} = \hat{x}^{\text{MAP}}_{t}
\end{align*}

% \subsubsection*{\textbf{Kalman filter}}
% \begin{align*}
%    \hat{x}_{t+1|t} &= A \hat{x}_{t|t} \\
%    P_{t+1|t} &= A P_{t|t} A^T + Q \\
%     K_{t+1} &= P_{t+1|t} C^T (C P_{t+1|t} C^T + R)^{-1} \\
%     r_{t+1} &= y_{t+1} - C \hat{x}_{t+1|t} \\
%    \hat{x}_{t+1|t+1} &= \hat{x}_{t+1|t} + K_{t+1}r_{t+1} \\
%    P_{t+1|t+1} &= (I - K_{t+1} C) P_{t+1|t}
% \end{align*}
% \subsubsection*{\textbf{RTS smoother}}
% \begin{align*}
%    F_t &= P_{t|t} A^T P_{t+1|t}^{-1} \\
%    \hat{x}_{t|t+1} &= \hat{x}_{t|t} + F_t(\hat{x}_{t+1|t+1} - A \hat{x}_{t|t}) \\
%    P_{t|t+1} &= P_{t|t} + F_t(P_{t+1|t+1} - P_{t+1|t})F_t^T
% \end{align*}

\section{Problem Formulation}
This section introduces the Gaussian-Bernoulli mixture observation model and explains its motivation. Following this, we describe our objectives and formulate them as a dual-variable optimization problem involving state estimation and Boolean decision-making. To avoid unnecessary complexity, we describe the problem under a single sensor scenario.

\subsection{Cyber Physical System Model}
We consider a linear time-invariant system with process and measurement noise:
\begin{align}
\left\{\begin{matrix}
 x_{t+1} &=& Ax_t + w_t \\
 y_{t} &=& Cx_t + \bar{v}_t
\end{matrix}\right.
\end{align}
where $x_t \in \mathbf{R}^n$ is the state, $y_t \in \mathbf{R}^m$ the measurement, and the pair $(A,C)$ is observable. We assume the process noise $\{w_t \}$ satisfies i.i.d Gaussian distribution $\mathcal{N}(0,Q)$, and is not uncorrelated with measurement noise $\{\bar{v}_t\}$, which is non-Gaussian, especially when under attack. 

Significantly, reducing the false alarm rate of detectors is the motivation for not using the standard Gaussian model to describe observations. In most of paper, the probability of observing low-probability events is ignored by Gaussian model, even though their real distribution is crucial for determining whether an attack has occurred. To tackle it, we consider a more general model:
\begin{align}
    \bar{v}_t = v_t+\Delta v_t
\end{align}
where $\{v_t\}$ has Gaussian distribution, and $\{\Delta v_t\}$ denotes the discrepancy between the real noise and the fitted Gaussian distribution, including outliers and malicious sensor attacks. 

The challenge is how to model $\Delta v_t$. There are two intuitions for modeling $\Delta v_t$. On the one hand, since no prior information about external attacks is available, it is reasonable to assume that the attack signals follow a non-informative distribution over a finite interval. On the other hand, although the exact distribution of outliers is difficult to characterize, the occurrence of abnormal events can be modeled using a Bernoulli distribution.\\


\begin{assumption}\label{assumption 1}
    The measurement noise $\{\bar{v}_t\}$ is expressed as a Gaussian-Bernoulli mixture model:
    \begin{align}
        \bar{v}_t = v_t+\Delta v_t = v_t+p_t * \delta_t
    \end{align}
where $\{v_t\}$ has Gaussian ditribution $\mathcal{N}(0,R)$, $\{p_t\}$ has Bernoulli distribution $\mathcal{B}(N,\beta)$, and $\{\delta_t\}$ has uniform distribution with unknown probability density. Random variables $\{p_t\}, \{\delta_t\}, \{v_t\}$ are uncorrelated.
\end{assumption}
This mixture model can be interpreted as conforming to a Gaussian distribution with occasional unknown distribution.
We regard $\{p_t\}$ as observation indicators.

\subsection{Problem of Interest}
Our goal is to design a secure detector to determine whether the sequential observations of fixed length $N$ are reliable. The secure detector operates in parallel with the estimator that updates the state estimation. In other words, at a certain moment, the secure detector can use the observations before and after to determine whether it is reliable.

Suppose that the system's observation model conforms to Assumption \ref{assumption 1}. Without loss of generality, we assume the detector knows the distribution of the initial state $x_0 \sim \mathcal{N}(0,P_0), P_0>0$. To determine whether sensors have suffered attacks at interval $T=[0,N]$, the detector rechecks the observation sequences and evaluates the reliability of the sensors.

\begin{figure}[htbp]
\centering
\includegraphics[width=0.45\textwidth]{figures/description.png}
\caption{Illustration of the detection of sensor attacks.}
\end{figure}

For each sensor, the evaluation of the observation sequence relies on the inference of each observation. Under Assumption \ref{assumption 1}, $y_t$ is considered normal when $p_t=0$, as the observation noise conforms to a Gaussian distribution; whereas when $p_t=1$, the observation noise is with unknown distribution, which is considered abnormal. Based on the number of occurrences of $p_t = 1 $ within the observation indicators $p_{0:N}$, we can classify the sequential observations into three status: in normal case, with general outliers, or under malicious sensor attacks.

% \begin{table}[htbp]
% \centering
% \renewcommand{\arraystretch}{2}
% \begin{tabular}{c|c|c} % Table structure
% \rowcolor{gray!40}  % Deep color for the first row
% $\{p_0,\cdots,p_N\}$ & $\sum_{i=0}^N p_t$ & the status of observation sequence \\ \hline
% $0,0,0,\cdots,0$ & 0 & in normal case \\ \hline
% \makecell{$0,1,0,\cdots,0$ \\$\dots$} & $\le \tau$ & with general outliers \\ \hline
% \makecell{$\dots$ \\ $1,1,1,\cdots,1$} & $>\tau$ & under sensor attacks \\ \hline
% \end{tabular}
% \end{table}

The primary issue is how to estimate the indicator sequence $\hat{p}_{0:N}$ through the observation sequence $y_{0:N}$. If we know $x_t$ and $p_t \sim \mathcal{B}(1,\beta)$, we can infer $\hat{p}_t$ by comparing the posterior probabilities of $p_t=0$ and $p_t=1$,
\begin{align}
    \max_{\hat{\delta}_t} P(p_t=0,\hat{\delta}_t|y_t)
    =&  \exp\left(-\frac{1}{2}\|y_t-C{x}_t\|^2_{R^{-1}}\right) \notag\\ &\cdot (1-\beta) \cdot p({\delta}_t^1)\\
    \max_{\hat{\delta}_t} P(p_t=1,\hat{\delta}_t|y_t)\
    =& \exp\left(0\right) \cdot \beta \cdot p({\delta}_t^2)
\end{align}
Because ${\delta}_t$ follows a uniform distribution, inferring the value of $p_t$ is equivalent to solving the following optimization problem:
\begin{align}
    \arg\min_{\hat{p}_t \in \{0,1\}}~  \left \{ (1-\hat{p}_t)\|y_t - C{x}_t\|^2_{R^{-1}} + \alpha \hat{p}_t \right \}
\end{align}
where $\alpha \propto \ln{(\frac{1-\beta}{\beta})}$ is a constant value calculated by the $\beta$ in Bernoulli distribution.

Estimating $\{x_t\}$ is a prerequisite for estimating $\{p_t\}$, and thus another core issue is how to obtain the optimal estimation of $\hat{x}_{0:N}$ through $y_{0:N}$. The distribution of noise is partially known under Assumption \ref{assumption 1}, hence the result of the classical Kalman filter is no longer the optimal estimation. However, if we neglect those observations with unknown distribution,  the state estimation can still be calculated based on those reliable observations $\{y_t|p_t=0\}$.

The problems of obtaining $\{\hat{p}_t\}$ and $\{\hat{x}_t\}$ are coupled. A reliable detector relies on accurate state estimator, while at the same time, effective elimination of anomalies contributes to better estimation performance. We formulate it as a dual-variable optimization problem.

\textbf{Problem 1}
\begin{align}
    \arg\min_{\hat{x}_{0:N},\hat{p}_{0:N}} ~\mathcal{W}&(\hat{x}_{0:N},\hat{p}_{0:N})= \Biggl\{\sum_{i=0}^N [(1-\hat{p}_i)\|y_i - C\hat{x}_i\|^2_{R^{-1}} \notag \\ +\alpha \hat{p}_i] 
    + &\sum_{i=1}^N \|\hat{x}_i - A\hat{x}_{i-1}\|^2_{Q^{-1}} 
    + \|\hat{x}_0\|^2_{P_0^{-1}}\Biggr\} \label{problem 1}
\end{align} 
It is a Mixed-Integer Programming (MIP) problem with continuous variables ($\hat{x}_{0:N}$) and Boolean variables ($\hat{p}_{0:N}$). Solving such problem is challenging due to the non-convexity of the objective function and the combinatorial complexity introduced by integer variables.

\begin{figure}[htbp]
\centering
\includegraphics[width=0.47\textwidth]{figures/MIP_new.png}
\caption{Illustration of the MIP problem. The red color represents the real system states in HMM. The blue color represents the observation sequence, which may contain unreliable data. The green color indicates the determination of the observation reliability in MIP problem. The yellow color signifies that it simultaneously estimate the system states with reliable observations.}
\end{figure}
\section{State Estimation with Secure Data: A Direct Computational Approach} \label{sec:Direct}
In this section, we first solve a special case of Problem 1, i.e., when the observation indicators are fixed, what is the closed-form solution of equation (\ref{problem 1})? Furthermore, when observation indicators changes, how should the solution of equation (\ref{problem 1}) be updated? These are the two key steps of our algorithm.

When $\hat{p}_{0:N}$ is fixed, we can denote the selected index set as $\mathcal{O}=\{i|\hat{p}_i=0\}$, and then Problem 1 is reduced into the following equivalent problem.

\textbf{Problem 2}
\begin{align}
    \arg\min_{\hat{x}_{0:N}} ~\mathcal{L}_{\mathcal{O}}&(\hat{x}_{0:N})= \Biggl\{\sum_{i \in \mathcal{O}} \|y_i - C\hat{x}_i\|^2_{R^{-1}} \notag \\ 
    + &\sum_{i=1}^N \|\hat{x}_i - A\hat{x}_{i-1}\|^2_{Q^{-1}} 
    + \|\hat{x}_0\|^2_{P_0^{-1}}\Biggr\} \label{equation map}
\end{align} 
The optimization objective of equation (\ref{equation map}) corresponds to a MAP state estimation problem. This problem can be translated into the following question. The goal is to estimate the state sequence $x_{0:N}$ based on a partial observation set $ y_\mathcal{O} = \{y_i \mid i \in \mathcal{O}\}$, where $y_\mathcal{O} \subseteq y_{0:N}$, in which the measurement errors follow a zero-mean Gaussian distribution.

As mentioned in Section \ref{sec:C}, the solutions for MAP and LMMSE estimation in linear Gaussian systems are the same. Therefore, in this section, we present a direct solution to equation (\ref{equation map}) from the perspective of LMMSE.

\subsection{Sequential Estimation with Partial Observations}
Under the condition of partial observations $y_\mathcal{O}$, our goal is to estimate the state sequence of the system. For a linear Gaussian system, we only need to solve an LMMSE problem, which involves finding the optimal linear relationship between the observations and the states. 

\begin{figure}[htbp]
\centering
\includegraphics[width=0.48\textwidth]{figures/MMSE_new.png}
\caption{The estimation of state sequence under partial observations $y_\mathcal{O}$}
\end{figure}

Define the column vectors $X = col\{x_0,\cdots,x_N\}, Y = col\{y_0,\cdots, y_N\}$ and $\hat{X}_\mathcal{O} = col\{\hat{x}_{0|\mathcal{O}},\cdots,\hat{x}_{N|\mathcal{O}}\}$. The following formulation describes the sequential estimation problem with partial observations.


\textbf{Problem 3}
\begin{equation}
\begin{array}{clll}
 \displaystyle \arg\min_{\hat{X}_\mathcal{O},K_\mathcal{O}}&  
J_{\mathcal{O}} =  E[\|X - \hat{X}_\mathcal{O}\|^2] \\
 \textrm{s.t.} &   \hat{X}_\mathcal{O} =  K_\mathcal{O} \cdot Y \\
\end{array}
\end{equation}
where each element in $X$ and $Y$ satisfies,
\begin{align*}
    x_{t+1} &\sim \hspace{0pt} \mathcal{N}(Ax_t, Q),\hspace{0.5pt} t=0,\cdots,N,            \\
     y_i &\sim \hspace{1pt} \mathcal{N}(Cx_i, R), \hspace{0.5pt} i \in \mathcal{O}, \\
     y_j &\sim \hspace{1pt} \mathcal{N}(0, \infty), \hspace{0.5pt} j \notin \mathcal{O}, \\
     x_0 &\sim \hspace{1pt} \mathcal{N}(0,P_0).
\end{align*}
This problem is equivalent to finding the optimal estimation for each state individually. Based on the linear estimation theory, the information from $y_\mathcal{O}$ can be well utilized by the Kalman filtering process and RTS smoother. It is worth mentioning that for those states missing corresponding observations, we can skip the step of measurement update. \\


\begin{lemma} \label{lemma:1}
    If the pair $(A, C)$ is observable, Problem 3 has a unique closed-form solution, which can be obtained through the following steps. 
    \begin{enumerate}
        \item Calculate $\{K_i\}$,$\{F_i\}$ according to the Kalman filter and RTS smoother process. For those intermittent observations that $\{y_j| j \notin \mathcal{O}\}$, set the Kalman gain to zero $\{K_j = 0 | j \notin \mathcal{O}\}$.
        \item Utilizing the $\{K_i\}$ and $\{F_i\}$ sequences, construct the $M_\mathcal{O}$, $L^*_\mathcal{O}$, and $H_\mathcal{O}$ matrices.
        {\small
        \begin{align*}
            M_\mathcal{O} &= \begin{bmatrix}
                K_{0} & 0 &  \cdots & 0\\
                \Phi(1) K_{0} & K_{1}  & \cdots & 0\\
                 \vdots & \vdots &  \vdots & \vdots\\
                 \Phi(N) K_{0} & \Phi(N-1) K_{1}  & \cdots &  K_{N}
                \end{bmatrix}, \\
            L^{*}_\mathcal{O}&=\begin{bmatrix}
             I & 0 &  \cdots & 0\\
             -CAK_{0} & I & \cdots & 0\\
             \vdots & \vdots &  \vdots & \vdots\\
             -C\Phi_p(N,1) K_{0} & -C\Phi_p(N,2) K_{1} & \cdots & I
            \end{bmatrix}, \\
            H_\mathcal{O} &= \begin{bmatrix}
             I-F_0\Phi(N)  & \cdots & \cdots & F_0...F_{N-1}\\
             \vdots & \vdots & \vdots & \vdots\\
            0 & 0 & I-F_{N-1}\Phi(1)  & F_{N-1}\\
            0 & 0 & 0 & I
            \end{bmatrix},
        \end{align*}}
        where $\Phi(k)=A^k$, $\Phi_p(k,j)=\prod_{i=j}^{k-1}(A-AK_iC)$.
        \item Calculate the solution of Problem 3.
        $$ \hat{X}_\mathcal{O} = K_\mathcal{O}Y,~ K_\mathcal{O} = H_\mathcal{O}M_\mathcal{O}L^{*}_\mathcal{O} $$
    \end{enumerate}
\end{lemma}

Proof: See Appendix \ref{appendices:A} for details. $\hfill \square$\\

\begin{remark}
    In multi-sensor systems, we can also order observations chronologically, while allowing for any sequence of simultaneous measurements. The measurement update and time update processes of the Kalman filter are still valid, and the RTS smoother only needs to consider the final error covariance matrices and the state estimate at each time step.
\end{remark}

 Moreover, Lemma~\ref{lemma:1} provides the explicit linear relationship between estimated states $\hat{x}_{0:N|\mathcal{O}}$ and the observations $y_\mathcal{O}$. For those $\{y_i|i \notin \mathcal{O}\}$, when multiplied by the matrix $K_\mathcal{O}$, the corresponding weights are zeros, which clearly indicates that they are unrelated to the estimate.

\subsection{Estimation Update with New Observations}
Suppose that we have obtained the optimal estimation under $y_{\mathcal{O}}$. When a new observation $y_k$ is added to the observation set, the optimal estimation of state sequence should be updated with new observation set $y_{\mathcal{O}^*} = y_{\mathcal{O}} \cup \{y_k\}$. Here $y_k$ also follows the Gaussian distribution. 
\begin{figure}[htbp]
\centering
\includegraphics[width=0.48\textwidth]{figures/switching_new.png}
\caption{Estimation update for new observation $y_k$ under the previous observation set $y_\mathcal{O}$} \label{switching}
\end{figure}

A basic approach is illustrated in Fig.~\ref{update step} by Lemma 1. In detail, we utilize the Kalman gain $\{K_t|t<k\}$ under $y_{\mathcal{O}}$ and recompute the rest process under $y_{\mathcal{O}^*}$.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.3\textwidth]{figures/update.png}
\caption{Recalculation steps for estimation update.} \label{update step}
\end{figure}

% We summarize in Algorithm~\ref{alg:1} how to transform equation (\ref{equation map}) into Problem 3 and directly seek its closed-form solution.

% \begin{algorithm}
% \caption{Direct approach for state estimation}
% \label{alg:1}
% \KwIn{the system parameters $\{A,C,Q,R\}$}
% \KwIn{initial state $(\bar{x}_0=0,\bar{P}_0)$ and the full observation set $y_{0:N}$}
% \KwOut{estimation of state sequence $\{\hat{x}_{0},\cdots,\hat{x}_{N}\}$}
% Initialize $Y=col\{y_0,\cdots,y_N\},P_{0} = \bar{P}_0, \mathcal{O} =  \emptyset $\;
% \tcp{Initialize the estimation}
% \For{$i = 1$ to $N$}{
%     $ K_i=0, P_{i|i}=P_{i|i-1} = AP_{i-1|i-1}A^T+Q $ \;
% }
% $ \hat{x}_\mathcal{O} = [0,\cdots,0]^T$\;
% \tcp{update with new observations}
% \Repeat{}{
%     \If{$\mathcal{O}$ changes to $\mathcal{O}^*$}{
%         $k$ = min($(\mathcal{O} \cup \mathcal{O}^*) \setminus (\mathcal{O} \cap \mathcal{O}^*)$)\;
%         $\mathcal{O} = \mathcal{O}^* $\;
%         \For{$i = k$ to $N$}{
%         \If{$i \ne 0$}{
%             $P_{i|i-1} = AP_{i-1|i-1}A^T+Q$\;}
%         \If{$i \in \mathcal{O}$}{
%             $K_i = P_{i|i-1}C^T (C P_{i|i-1} C^T + R)^{-1}$\;
%             $P_{i|i} = (I - K_i C) P_{i|i-1}$\;
%         }
%         \Else{
%             $K_i=0, P_{i|i}=P_{i|i-1}$\;
%         }
%     }
%     \For{$i=N-1$ to $0$}{
%         $F_i = P_{i|i}A^TP_{i+1|i}^{-1}$\;
%     }
%     Construct the $M_{\mathcal{O}}$, $L^*_{\mathcal{O}}$, and $H_{\mathcal{O}}$ matrices\;
%     Calculate $ \hat{X}_\mathcal{O} = H_{\mathcal{O}}M_{\mathcal{O}}L^*_{\mathcal{O}}Y$\;
%         }
% }
% \end{algorithm}
However, employing a direct method to compute the optimal estimate reveals limitations in computational cost. When $|y_{\mathcal{O}}|$ is large, especially in systems with multiple sensors, the direct method requires computing the matrix inverse $O(|y_{\mathcal{O}}|)$ times, which consumes significant computational resources. Furthermore, as the observation set expands, the optimal state estimate approaches the real state more closely. Nevertheless, adding new observations to a larger set $y_{\mathcal{O}}$ requires an increasing number of calculation steps to update the estimate, especially in multi-sensor systems. This indicates that using direct method to update cannot fully leverage the information from the previous estimation, and thus causes a waste of computational resources.

\section{State Estimation with Secure Data: An Iterative Computational Approach} 
\label{sec:iter}
In section \ref{sec:Direct}, we discussed how to find the closed-form solution of equation (\ref{equation map}), but its computational efficiency is poor. In this section, we propose an iterative method for state sequence estimation that allows for rapid convergence to the optimal estimate. 

The core idea of the iterative method is to fully utilize the previous estimates as the initial guess in the iteration. By constructing a composite convex optimization problem, we design a proximal gradient descent algorithm to avoid redundant computations. Furthermore, we derive the convergence rate and the iteration count through the reliability of previous estimates.

\subsection{Sequential Estimation with Partial Observations}
The objective function in equation \eqref{equation map} incorporates two goals: first, the state estimates $\hat{x}_{0:N}$ should match the observations $\hat{y}_{\mathcal{O}}$; second, the state estimates $\hat{x}_{0:N}$ should conform to the known structure of the system. Therefore, $\mathcal{L}_{\mathcal{O}}$ can be considered as the sum of two functions: 
\begin{align} 
    f &= \sum_{i \in \mathcal{O}} \|y_i - C\hat{x}_i\|^2_{R^{-1}} \\ 
    g &= \|\hat{x}_0\|^2_{P_0^{-1}} + \sum_{i=1}^N \|\hat{x}_i - A\hat{x}_{i-1}\|^2_{Q^{-1}} 
\end{align}
By stacking all $\hat{x}_i$ into a vector $\hat{X}= col\{\hat{x}_{0|\mathcal{O}},\cdots,\hat{x}_{N|\mathcal{O}}\}$, we construct a sparse matrix $\tilde{\mathcal{A}}$ to capture the relationship between the states:
\begin{align*}
\begin{bmatrix}
\hat{x}_0 \\
\hat{x}_1 - A \hat{x}_0 \\
\hat{x}_2 - A \hat{x}_1 \\
\vdots \\
\hat{x}_N - A \hat{x}_{N-1}
\end{bmatrix}=
\begin{bmatrix}
I & 0 & 0 & \cdots & 0 \\
-A & I & 0 & \cdots & 0 \\
0 & -A & I & \cdots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & \cdots & I
\end{bmatrix}\begin{bmatrix}
\hat{x}_0 \\
\hat{x}_1 \\
\hat{x}_2 \\
\vdots \\
\hat{x}_N
\end{bmatrix}=
\tilde{\mathcal{A}} \hat{X}.
\end{align*}
Thus the function $g$ can be written in the quadratic form:
\begin{align}
    g(\hat{X}) = \|\tilde{\mathcal{A}}\hat{X}\|_{\tilde{P}^{-1}}^2 = \|\hat{X}\|^2_{\tilde{\mathcal{A}}^T \tilde{P}^{-1} \tilde{\mathcal{A}}} \label{eq:norm}
\end{align}
where $\tilde{P}$ is a block-diagonal matrix,
\begin{align*}
\tilde{P} = 
\begin{bmatrix}
~~P_0~~ & 0 & 0 & \cdots & 0 \\
0 & ~~Q~~ & 0 & \cdots & 0 \\
0 & 0 & ~~Q~~ & \cdots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & \cdots & ~~Q~~
\end{bmatrix}.
\end{align*}

With the help of equation \eqref{eq:norm}, we convert Problem 2 to following composite convex optimization problem.

\textbf{Problem 4}
\begin{align}
\begin{array}{clll}
 \displaystyle   \arg\min_{\hat{X}} & ~\mathcal{L}_{\mathcal{O}}= f_{\mathcal{O}}(\hat{X})+g(\hat{X})
\end{array}
\end{align}
where 
\begin{align*}
f_{\mathcal{O}}(\hat{X}) &= \sum_{i \in \mathcal{O}} \|y_{i} - \tilde{C}_{i}\hat{X}\|^2_{R^{-1}},  \\
g(\hat{X}) &= \|\hat{X}\|_{H}^2, \quad H={\tilde{\mathcal{A}}^T \tilde{P}^{-1} \tilde{\mathcal{A}}},
\end{align*}
and $\tilde{C}_i$ is a row block matrix, with the 
i-th block being matrix $C$, while all other blocks are zero matrices.

The term $f_{\mathcal{O}}(\hat{X})$ represents the goal of fitting the observation information, which evolves as the observation set is updated. The term $g(\hat{X})$ represents a kind of normalization of estimated states, aiming to conform the system structure. \\

\begin{definition}
    The function $h(x)$ is an $L$-smooth and $\lambda$-strongly convex function if it satisfies the following condition: $\forall x, x^0$,
    \begin{align*}
        h(x) &\le h(x^0) + \nabla h(x^0)^T(x-x^0) + \frac{L}{2}\|x-x^0\|^2_2, \\
        h(x) &\ge h(x^0) + \nabla h(x^0)^T(x-x^0) + \frac{\lambda}{2}\|x-x^0\|^2_2.        
    \end{align*}
\end{definition}
\vspace{-4pt}
\begin{proposition}
    Suppose the smooth and strong convexity of $f_{\mathcal{O}}(\hat{X})$ and $g(\hat{X})$ holds with $L_f,\lambda_f,L_g,\lambda_g$, then the following inequalities hold
    \begin{align*}
        L_f &= \begin{cases} 
        0, & \text{if } \mathcal{O} = \emptyset \\
        \lambda_{\text{max}}(C^T R^{-1} C), & \text{otherwise}
        \end{cases},  \\
        \lambda_f &= \begin{cases} 
        \lambda_{\text{min}}(C^T R^{-1} C), & \text{if } \mathcal{O} = \{0, 1, 2, \dots, N\} \\
        0, & \text{otherwise}
        \end{cases}, \\
        L_g &= \lambda_{max}(H) \ge \lambda_{min}(H) 
        = \lambda_g \ge 0.
    \end{align*}
\end{proposition}
\vspace{-5pt}

Proof. It follows from Definition 1 and is omitted. $\hfill \square$

In addition, we use proximal gradient descent to iteratively optimize the solution. Define $f^t_{\mathcal{O}}(x)$ as the approximate function and $prox_{\eta g}(\cdot)$ as the proximal operator:
\begin{align*}
    f^t_\mathcal{O}(x) &= f(x^t) + \nabla f_\mathcal{O}(x^t)^T(x-x^t) + \frac{1}{2\eta_t}\|x-x^t\|^2_2, \\
    prox_{\eta g}(x) &= \arg\min_{z} \left [ \frac{1}{2}\|z-x\|^2_2+\eta g(z) \right ].
\end{align*}
The following theorem demonstrates how to iteratively solve for the optimal solution to Problem 4.  \\

\begin{theorem}\label{theorem:2}
    Suppose $X^*$ is the unique solution of Problem 4. With the fixed learning rate $\eta = \frac{1}{\lambda_{\text{max}}(C^T R^{-1} C)} \le \frac{1}{L_f}$, repeat the following step and $X^{t}$ will converge to $X^*$:
    \begin{align}
        X^{t+1} &=  prox_{\eta g}(\arg\min_{X} f^t_\mathcal{O}(X))\notag \\
        &= prox_{\eta g}(X^t-\eta\nabla f_\mathcal{O}(X^t)) \notag\\ &= (I+\eta H)^{-1}(X^t -  \eta\nabla f_\mathcal{O}(X^t)).
    \end{align}
    Then one has the following result (convergence rate): %
\begin{equation}
    \mathcal{L}_{\mathcal{O}}(X^t) \le \mathcal{L}_{\mathcal{O}}(X^*)+(1-\theta)^t[\mathcal{L}_{\mathcal{O}}(X^0)- \mathcal{L}_{\mathcal{O}}(X^*)]
\end{equation}
    where $\theta = (\eta\lambda_f+\eta\lambda_g)/(1+\eta\lambda_g)$.
\end{theorem}

Proof: See Appendix \ref{appendices:B} for details. $\hfill \square$\\

\begin{remark}
    In multi-sensor systems, the only difference is the function $f_\mathcal{O}$, which is composed of observations from multiple different sensors. The iterative update process and the derivation of the convergence rate are similar to those in a single-sensor system.
\end{remark}
We can interpret this iterative process from the perspective of filter and smoother. The term $X^t-\eta\nabla f_\mathcal{O}(X^t)$ is comparable to the measurement update step in Kalman filtering, where $\nabla f_\mathcal{O}(X^t)$ corresponds to the residual and a fixed parameter $\eta$ corresponds to the Kalman gain. The term $(I+\eta H)^{-1}$ can be regarded as a smoother, updating the estimate based on system dynamics.

Solving Problem 4 using Theorem 2 will yield the same result as solving Problem 3 with Lemma 1. However, compared to Lemma 1, the iterative approach provides by Theorem 2 does not require calculating the Kalman gain and smoother gain at each step. Instead, it replaces the filter gain with a fixed parameter $\eta$ and the smoother gain with a fixed matrix $(I+\eta H)^{-1}$, converging to the optimal estimate after several iterations. This provides a new perspective on estimation update.

\subsection{Estimation Update with New Observations}
Suppose that we have computed the optimal estimate $\hat{X}_\mathcal{O}$ under $y_\mathcal{O}$. Then, as shown in Fig.~\ref{switching}, a new observation $y_{k}$ is added to the observation set, and we attempt to update the state sequence estimate using Theorem~\ref{theorem:2}.

Denote the updated observation set as $y_\mathcal{O^*} = y_\mathcal{O} \cup \{y_{k}\}$. Algorithm~\ref{alg:2} provides the details of calculating  the optimal
estimate with iterative method.

\begin{algorithm}
\small 
\caption{Iterative approach for state estimation}
\label{alg:2}
\begin{algorithmic}[1]
\Require system parameters $\{A,C,Q,R\}$, stop condition $\epsilon$
\Require initial state $(\bar{x}_0=0,\bar{P}_0)$, full observation set $y_{0:N}$
\Ensure estimation of state sequence $\{\hat{x}_{0},\cdots,\hat{x}_{N}\}$

\State Calculate the matrix $H$, Lipschitz constant $L_f$, and $R^{-1}$
\State Choose $\eta < 1/L_f$ and compute $(I+\eta H)^{-1}$
\State Initialize $\mathcal{O} \gets \emptyset$, $\hat{X}_\mathcal{O} \gets \text{col}\{\hat{x}_{0|\mathcal{O}}=0,\cdots,\hat{x}_{N|\mathcal{O}}=0\}$
\Repeat \Comment{Update with new observations}
    \If{$\mathcal{O}$ changes to $\mathcal{O}^*$}
        \State $\hat{X} \gets \hat{X}_\mathcal{O}$
        \Repeat
            \State $\nabla f_{\mathcal{O}^*} \gets \sum_{i\in \mathcal{O}^*} C_i^T R^{-1}(y_i - C_i \hat{X})$
            \State $\hat{X}^* \gets (I+\eta H)^{-1}(\hat{X} - \eta \nabla f_{\mathcal{O}^*})$
            \If{$|\mathcal{L}_{\mathcal{O}^*}(\hat{X}) - \mathcal{L}_{\mathcal{O}^*}(\hat{X}^*)| < \epsilon$}
                \State \textbf{break}
            \Else
                \State $\hat{X} \gets \hat{X}^*$
            \EndIf
        \Until{converged}
        \State $\mathcal{O} \gets \mathcal{O}^*$, $\hat{X}_\mathcal{O} \gets \hat{X}^*$
    \EndIf
\Until{$\mathcal{O}$ remains unchanged}
\end{algorithmic}
\end{algorithm}
% \begin{algorithm}[!h]
% \caption{Iterative approach for state estimation}
% \label{alg:2}
% \KwIn{the system parameters $\{A,C,Q,R\}$ and the stop condition $\epsilon$}
% \KwIn{initial state $(\bar{x}_0=0,\bar{P}_0)$ and the full observation set $y_{0:N}$}
% \KwOut{estimation of state sequence $\{\hat{x}_{0},\cdots,\hat{x}_{N}\}$}
% Calculate the matrix $H, L_f$ and $R^{-1}$\;
% Choose the $\eta < 1/L_f$ and calculate $(I+\eta H)^{-1}$\;
% Initialize $\mathcal{O} = \emptyset$, $\hat{X}_\mathcal{O} = col\{\hat{x}_{0|\mathcal{O}}=0,\cdots,\hat{x}_{N|\mathcal{O}}=0\}$\;
% \tcp{update with new observations}
% \Repeat{}{
%     \If{$\mathcal{O}$ changes to $\mathcal{O}^*$}{
%         $\hat{X} = \hat{X}_\mathcal{O}$\;
%         \Repeat{}{
%         $\nabla f_{\mathcal{O}^*}= \sum_{i\in \mathcal{O}^*} C_{i}^TR^{-1}(y_{i}-C_{i}\hat{X})$\;
%         $\hat{X}^* = (I+\eta H)^{-1} (\hat{X}-\eta \nabla f_{\mathcal{O}^*}(\hat{X}))$\; 
%         \If{$|\mathcal{L}_{\mathcal{O}^*}(\hat{X})-\mathcal{L}_{\mathcal{O}^*}(\hat{X}^*)| < \epsilon$}{
%             break\;
%         }
%         \Else{
%             $\hat{X} = \hat{X}^*$\;
%         }}
%         $\mathcal{O} = \mathcal{O}^*,\hat{X}_{\mathcal{O}} = \hat{X}^*$\;
%         }
% }
% \end{algorithm}

Compared to the direct approach, this iterative method for updating estimates has two advantages. Firstly, the iterative method does not compute the inverse matrix to obtain the optimal gain, but only requires matrix multiplication, and the fixed inverse matrices $(I+\eta H)^{-1}$ and $R^{-1}$ can be calculated in advance. Secondly, the previous estimate can be used as the initial value of the iteration and the information from the previous observation set can be fully utilized.

When $|y_{\mathcal{O}}|$ is large, the term $f_{\mathcal{O}}$ changes slightly with new observations, leading to minor differences between $\hat{X}_{\mathcal{O}^*}$ and $\hat{X}_{\mathcal{O}}$. This implies that as the impact of the new observation on $f_{\mathcal{O}}$ becomes more negligible, the algorithm will converge more rapidly. Theorem~\ref{theorem:3} provides a quantitative analysis of the maximum number of iterations when new observations are added. \\

\begin{theorem}\label{theorem:3}
    Suppose that the observation set changes from $y_\mathcal{O}$ to $y_\mathcal{O^*} = y_\mathcal{O} \cup \{y_{k}\}$. Let the $X^0=\hat{X}_\mathcal{O}$ as the initial value of the iterations and $x_k \sim \mathcal{N}(\hat{x}_{k|\mathcal{O}}, P_{k|\mathcal{O}})$. If the optimal solution is $X^*$ and the stop condition is $\epsilon$ that $|L_{\mathcal{O^*}}(X^{\tau})-L_{\mathcal{O^*}}(X^*)|<\epsilon$,  the maximum iteration number $\tau$ satisfies
    \begin{align}
        \tau < \log_{1-\theta}\left({\frac{\epsilon}{\|\Xi \xi\|^2_{R^{-1}} + 2\|\Xi \|_{R^{-1}}\|\xi \|_{R^{-1}}}}\right),
    \end{align}
    where 
    \begin{align*}                  
        \xi &= y_{k}-C\hat{x}_{k|\mathcal{O}}, \\
        \Xi &= CP_{k|\mathcal{O}}C^T(CP_{k|\mathcal{O}}C^T+R)^{-1}.
    \end{align*}
\end{theorem}

Proof: See Appendix \ref{appendices:C} for details. $\hfill \square$

Theorem~\ref{theorem:3} implies that the more reliable the initial $\hat{x}_k$ is, the fewer iterations are required for convergence. Thus, as the observation set $y_{\mathcal{O}}$ expands, the number of iterations required for the estimation update decreases.
\section{Secure State Estimation Method and Convergence Analysis}
In this section, we aim to solve the targeted MIP problem presented in \eqref{problem 1}. Summarized in Fig.~\ref{MIP solver}, the GBS estimator involves repeating two steps: assessing the reliability of observations and updating estimates. The algorithms introduced in Section \ref{sec:Direct} and Section  \ref{sec:iter} facilitate the estimation update in response to changes in reliable observation set.

\begin{figure}[htbp]
\centering
\includegraphics[width=0.45\textwidth]{figures/MIP_solver.png}
\caption{The framework of GBS estimator. GBS estimator comprises two components: the resilient estimator and the secure detector. The green arrow indicates the resilient estimator, which estimates the state based on reliable observations. The red arrow denotes the secure detector, which identifies reliable observations based on the estimated state.} \label{MIP solver}
\end{figure}

\subsection{Initial Strategy for Rough Estimation}
A good initial value is beneficial for solving problems. However, at first, we do not know the initial values of $\hat{p}_{0:N}$ and $\hat{x}_{0:N}$. Therefore, the initial strategy aims to roughly estimate the value of the observation indicators $p_{0:N}$ based on $y_{0:N}$.

The key idea of the initial strategy is to estimate $\{\hat{x}_t\}$ sequentially and to roughly determine the value of $\hat{p}_{t+1} $ through $\hat{x}_t$. If $\hat{p}_{t+1}=0$, the observation $y_{t+1}$ is utilized for the state estimation of $x_{t+1}$ through Kalman filter. Algorithm~\ref{alg:3} provides the details of initial strategy.

\begin{algorithm}
\small
\caption{Initial strategy for rough estimation}
\label{alg:3}
\begin{algorithmic}[1]
\Require system parameters $\{A, C, Q, R, \alpha\}$
\Require initial state estimate $(\bar{x}_0 = 0, \bar{P}_0)$ and full observation set $y_{0:N}$
\Ensure estimated indicators $\hat{p}_{0:N}$ and states $\hat{x}_{0:N}$

\State Initialize $\hat{x}_0 \gets \bar{x}_0$, $P_0 \gets \bar{P}_0$
\For{$i = 0$ to $N$}
    \State $\hat{p}_i \gets \textbf{bool}(\|y_i - C\hat{x}_i\|^2_{R^{-1}} < \alpha)$
    \If{$\hat{p}_i = 1$}
        \State $K_i \gets P_i C^T (C P_i C^T + R)^{-1}$
        \State $\hat{x}_i \gets \hat{x}_i + K_i (y_i - C\hat{x}_i)$
        \State $P_i \gets (I - K_i C) P_i$
    \EndIf

    \State $\hat{x}_{i+1} \gets A \hat{x}_i$
    \State $P_{i+1} \gets A P_i A^T + Q$
\EndFor
\end{algorithmic}
\end{algorithm}

\subsection{Gaussian-Bernoulli Secure (GBS) Estimator}
The approach to solving Problem 1 is to iteratively optimize the estimates by fixing $\hat{p}_{0:N}$ and $\hat{x}_{0:N}$, respectively. 

First, consider to minimize the objective function with fixed $\hat{p}_{0:N}^*$. When $\hat{p}_{i}^*=0$, the term $(1-\hat{p}_{i}^*)\|y_{i}-C\hat{x}_i\|^2_{R^{-1}}$ is active, meaning that the objective will consider the ``fit" between the state and the measurement. When $\hat{p}_{i}^*=1$, the term $(1-\hat{p}_{i}^*)\|y_{i}-C\hat{x}_i\|^2_{R^{-1}}$ is non-functional, meaning to reject using such observation information to ``update" the state estimation. Thus, we can simplify equation \eqref{problem 1} as follows:
\begin{align}\label{eq:17}
    \arg\min_{\hat{x}_{0:N}}~ \mathcal{W} (\hat{x}_{0:N},\hat{p}_{0:N}^*)
    = \mathcal{L}_{\mathcal{O}}(\hat{x}_{0:N}),
\end{align}
where the set $\mathcal{O} = \{i,|\hat{p}_{i}^*=0\}$. For LMMSE estimator and MAP estimator achieve the same result, we can implement either the direct approach (Lemma~\ref{lemma:1}) or the iterative approach (Theorem~\ref{theorem:2}) to calculate optimal $\hat{x}_{0:N}$.

Second, seek the minimal $\hat{p}_{0:N}$ with fixed state estimation $\hat{x}_{0:N}^*$. When state estimation $\hat{x}_i^*$ is determined, the term $(1-\hat{p}_i)\|y_i-C\hat{x}_i^*\|^2_{R^{-1}}$ is debatable, depending on the comparison between $\|y_i-C\hat{x}_i^*\|^2_{R^{-1}}$ and the penalty $\alpha$. Equation \eqref{problem 1} with fixed $\hat{x}_{0:N}^*$ can be written as follows:
\begin{align}\label{eq:18}
    \arg \min_{\hat{p}_{0:N}}~ \mathcal{W} 
    =  \sum_{i=0}^{N} [(1-\hat{p}_{i})\|y_{i}-C\hat{x}_i^*\|^2_{R^{-1}} + \hat{p}_{i} \alpha] 
\end{align}
 and its solution can be easily obtained
 \begin{align}
     \hat{p}_{i} = \textbf{bool}(\|y_{i}-C\hat{x}_i^*\|^2_{R^{-1}} > \alpha).
 \end{align}
However, the aforementioned iteration may be rigid and often converges to suboptimal points. Here, we consider optimizing the indicator $\hat{p}_{k}$ simultaneously with the estimated states $\hat{x}_{0,N}$. Denote the index set as $\mathcal{O}_{k}^+=\{i|\hat{p}^*_{i}=0\} \cup\{k\}$ and $\mathcal{O}_{k}^-=\mathcal{O}_{k}^+\setminus \{k\}$. Then, the portion of the objective function in \eqref{problem 1} that includes $\hat{p}_k$ and $\hat{x}_{0:N}$ can be written as two parts:
\begin{align}
    \mathcal{L}_{\mathcal{O}_{k}^-}(\hat{x}_{0:N}) =& \Biggl\{\sum_{i \in \mathcal{O}_{k}^-} \|y_i - C\hat{x}_i\|^2_{R^{-1}} + \|\hat{x}_0\|^2_{P_0^{-1}} \notag \\ 
    & + \sum_{i=1}^N \|\hat{x}_i - A\hat{x}_{i-1}\|^2_{Q^{-1}} 
    \Biggr\}, \\
    \mathcal{P}_k(\hat{p}_{k}) =& (1-\hat{p}_{k})\|y_{k}-C\hat{x}_k\|^2_{R^{-1}} + \hat{p}_{k} \alpha.
\end{align}
We can update $\hat{p}_{k}$ by solving the optimization problem:
\begin{equation}\label{eq:20}
\begin{array}{clll}
 \displaystyle \arg\min_{\hat{p}_{k},\hat{x}_{0:N}} & \biggl \{\mathcal{L}_{\mathcal{O}_{k}^-}(\hat{x}_{0:N}) + \mathcal{P}_k(\hat{p}_{k}) \biggl\}
\end{array}
\end{equation}
and the optimal $\hat{p}_{k}$ can be determined by:
\begin{align}
    \hat{p}_{k} = \textbf{bool}((\min \mathcal{L}_{\mathcal{O}_{k}^+} - \min \mathcal{L}_{\mathcal{O}_{k}^-})>\alpha).
\end{align}
As described in Algorithm~\ref{alg:4}, we iteratively calculate equation \eqref{eq:17} and  \eqref{eq:18}, and improve the optimality through equation \eqref{eq:20}.


\begin{algorithm}
\caption{Gaussian-Bernoulli Secure Estimator}
\label{alg:4}
\begin{algorithmic}[1]
\Require system parameters $\{A,C,Q,R,\alpha,\tau\}$
\Require initial state $(\bar{x}_0,\bar{P}_0)$ and observations $y_{0:N}$
\Ensure $\hat{x}_{0:N},\hat{p}_{0:N}$

\State Initialize $\hat{x}_{0:N}^0,\hat{p}_{0:N}^0$ using Algorithm~\ref{alg:3}
\State Set count $k=0$ and ${\mathcal{O}^0} = \{i \mid \hat{p}_{i}^0 = 0\}$

\Repeat
    \State $k \gets k + 1$
    \For{$i = 0$ to $N$} 
        \State $\hat{p}_{i}^k = \textbf{bool}(\|y_i - C\hat{x}_i^*\|^2_{R^{-1}} > \alpha)$
    \EndFor \Comment{$\arg \min_{\hat{p}_{0:N}} ~ \mathcal{L} (\hat{x}_{0:N}^*,\hat{p}_{0:N})$}
    \State Update $\mathcal{O}^k = \{i \mid \hat{p}_{i}^k = 0\}$
    
    \If{$\mathcal{O}^k = \mathcal{O}^{k-1}$} 
        \For{$i = 0$ to $N$}
            \State $\hat{p}_i^* = \textbf{bool}((\min \mathcal{L}_{\mathcal{O}_i^+} - \min \mathcal{L}_{\mathcal{O}_i^-}) > \alpha)$
            \If{$\hat{p}_i^* \ne \hat{p}_i^k$}
                \State $\hat{p}_i^k \gets \neg \hat{p}_i^k$, update $\mathcal{O}^k$
                \State \textbf{break}
            \EndIf
        \EndFor
    \EndIf \Comment{check suboptimal points}

    \If{$\mathcal{O}^k = \mathcal{O}^{k-1}$}
        \State \textbf{break}
    \Else
        \State Update optimal estimates $\hat{x}_{0:N}$
    \EndIf \Comment{$\arg \min_{\hat{x}_{0:N}}~ \mathcal{L} (\hat{x}_{0:N},\hat{p}_{0:N}^*)$}
\Until{}
\If{$(N-|\mathcal{O}^k|) > \tau$}
    \State \textbf{Print:} \texttt{info("attack alarm in this sensor!")}
\EndIf
\end{algorithmic}
\end{algorithm}

\subsection{Convergence analysis}
In this subsection, we prove the convergence of our proposed GBS estimator algorithm. 

First, we demonstrate the existence of the solution to our target MIP problem presented in \eqref{problem 1}. As a $0-1$ sequence $\hat{p}_{0:N} \in \{0,1\}^{(N+1)}$, there are a total of $2^{(N+1)}$ cases. For $\{0,1\}^{(N+1)} \leftrightarrow 2^{\{0,\cdots,N\}}$, we can define a mapping from the indicator set to the index set that 
\begin{align}
    \mathcal{O}^* = \mathcal{G}(\hat{p}_{0:N}^*) = \{i|\hat{p}^*_{i}=0\}
\end{align}
When the observation set is fixed, the optimal estimation can be obtained as a unique solution through Lemma~\ref{lemma:1} or Theorem~\ref{theorem:2}. We can also define it as a mapping:
\begin{align}
    \hat{x}_{0:N}^* = \mathcal{H}(\mathcal{O}^*) = \arg\min_{\hat{x}_{0:N}} \mathcal{L}_{\mathcal{O}^*} (\hat{x}_{0:N})
\end{align}
Therefore, the optimal solution of the Problem 1 can be found through finite enumeration.
\begin{align}
    \arg\min_{\hat{p}^*} \hspace{0.3cm} \mathcal{W} ((\mathcal{H} \circ \mathcal{G})(\hat{p}^*),\hat{p}^*), ~\hat{p}^* \in \{0,1\}^{(N+1)}
\end{align}
Then, we prove that $\hat{p}^k$ will ultimately converge, thereby determining $\hat{x}_{0:N}$. Assume that at the $k-${th} iteration, $\hat{x}_{0:N}^k = (\mathcal{H} \circ \mathcal{G})(\hat{p}^k_{0:N})$. 
When updating the $\hat{p}^{k+1}_{0:N}$ and $\hat{x}^{k+1}_{0:N}$ according to Algorithm~\ref{alg:4}, the following inequality holds:
\begin{equation*}
\mathcal{W} (\hat{x}_{0:N}^{k+1},\hat{p}^{k+1}_{0:N}) \le \mathcal{W} ~ (\hat{x}_{0:N}^k,\hat{p}^{k+1}_{0:N}) \le \mathcal{W} (\hat{x}_{0:N}^k,\hat{p}^k_{0:N}).
\end{equation*}
Therefore, the $0-1$ sequence $\hat{p}_{0:N}$ will iteratively minimize the objective function  $\mathcal{W}$ in a monotonically nonincreasing way until $\hat{p}^{k+1}_{0:N} = \hat{p}^{k}_{0:N}$.
\section{Numerical Simulations}
In this section, we introduce the comprehensive experimental results. First, we compare the update speeds of direct and iterative methods under different observation update rules. Then, we compare our GBSE with other detectors and estimators from the perspectives of detection and estimation performance. Next, we demonstrate the detection capabilities of our GBSE algorithm in a multi-sensor system. 

Although our previous focus is on the single-sensor system, the derivation process and conclusions are also applicable to multi-sensor systems. For a multi-sensor system equipped with $M$ sensors, $y_{i,j}$ denotes the observation at the sensor $j$ at time $i$, and the corresponding indicator is defined as $p_{i,j}$.

\subsection{Comparison of Direct and Iterative Approach}
Consider a 3-dimensional system with $M$ sensors over the interval $T = [0,N]$:
\begin{align*}
    M=N=100, \hspace{0.2cm} x_0 \sim \mathcal{N}(0,I), \hspace{0.2cm} A=C=I, \\
    Q_i = R_j =\begin{bmatrix}
    1  & 0.5 & 0\\
     0.5 & 1 & 0.5\\
     0 & 0.5 & 1
    \end{bmatrix}, \begin{matrix}
 i= 0,...,N\\
j=1,...,M
\end{matrix}.
\end{align*}
The full observation set is $y_{0:N,1:M}$. The observation set is updated according to a specific pattern, denoted as $\mathcal{O}_k \in 2^{\{0,\cdots,N\}\otimes \{1,\cdots,M\}}$ for the $k-$th update. Our algorithm is to update the state estimates of $x_{0:N}$ based on the observation set $\mathcal{O}_k$.

First, in Fig.~\ref{add observations}, we implement experiments to add observations along the timeline, which is the default observation update rule for most systems. The newly added observations include the observations from all sensors at time $k$ that $\mathcal{O}_k \setminus \mathcal{O}_{k-1} = \{k\} \otimes \{1,\cdots,M\}$.  Additionally, in Fig.~\ref{add sensor}, we are interested in incorporating observations in the order of sensor indices. The rules for observation updates allow the system to update one after another based on the reliability of the sensors. The new observations add to the set from $k$-th sensor that $\mathcal{O}_k \setminus \mathcal{O}_{k-1} = \{0,\cdots,N\} \otimes \{k\}$. Moreover, in Fig.~\ref{insert observations}, we test randomly updated observation sets, similar to the setup in Algorithm\ref{alg:4}. We first hide part of the observations and compute the optimal estimate. Then, we add the masked observations back and record the computation time required to update the estimate.
\begin{figure}[htbp]
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{minipage}{0.5\textwidth}
            \includegraphics[width=\linewidth]{exp/exp2/timeline.png}
        \end{minipage}
        \begin{minipage}{0.38\textwidth}
            \includegraphics[width=\linewidth]{exp/exp2/add_observations.jpg}
        \end{minipage}
        \caption{add observations along the timeline}     \label{add observations}
    \end{subfigure}
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{minipage}{0.5\textwidth}
            \includegraphics[width=\linewidth]{exp/exp2/sensor_indices.png}
        \end{minipage}
        \begin{minipage}{0.38\textwidth}
            \includegraphics[width=\linewidth]{exp/exp2/add_sensors.jpg}
        \end{minipage}
        \caption{add observations in the order of sensor indices}     \label{add sensor}
    \end{subfigure}
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{minipage}{0.5\textwidth}
            \includegraphics[width=\linewidth]{exp/exp2/insert.png}
        \end{minipage}
        \begin{minipage}{0.38\textwidth}
            \includegraphics[width=\linewidth]{exp/exp2/insert_observations.jpg}
        \end{minipage}
        \caption{insert the different proportions of observations}     \label{insert observations}
    \end{subfigure}
    \caption{Comparison of direct approach and iterative approach under different observation update rules. In the left figure, the arrow indicates the direction of the observation updates, with the pink representing the past observation set and the yellow representing the newly added observations. In the right figure, the blue dots represent the number of iterations of the iterative approach.}
\end{figure}

The results show that the direct and iterative methods work best in different situations. The direct method is more efficient for timeline-based updates, while the iterative method is better when a small, unordered part of the observation set is updated. The iterative method is also preferred when adding new sensors.

\subsection{Compared with Other Detectors and Estimators}
Consider the scale system with two sensors at interval $T=[0,N]$, where
$x_0 \sim \mathcal{N}(0,1), A=1, C_1=C_2=1, Q=0.5, R_1=R_2=2, N=20$. Let’s consider that sensor $1$ is functioning normally, while sensor $2$ has been injected with false information under attack at time $t$.
\begin{align}
    \tilde{y}_{t,2} = y_{t,2} + e_t, \: t=1,2,..,20,
\end{align}
where $e_t$ denotes the injected attack signal.

We implement three common attack strategies in our experiment. Fig.~\ref{attack a} represents the random interference, where $e_t \sim N(0,\tilde{R})$. Fig.~\ref{attack b} indicates a constant effect on the sensor, where $e_t = \mu_{\text{constant}}$ starting from time $t=10$. Fig.~\ref{attack c} illustrates a uniformly increasing impact on the sensor, where $e_t=\frac{t}{N}\mu_{\text{max}}$.
\begin{figure}[htbp]
    \centering
    \begin{subfigure}[b]{0.165\textwidth}
        \centering
        \includegraphics[width=\textwidth]{exp/exp3/attack_1.png}
        \subcaption{random inference}
        \label{attack a}
    \end{subfigure}
    \begin{subfigure}[b]{0.15\textwidth}
        \centering
        \includegraphics[width=\textwidth]{exp/exp3/attack_2.png}
        \subcaption{constant bias}
        \label{attack b}
    \end{subfigure}
    \begin{subfigure}[b]{0.15\textwidth}
        \centering
        \includegraphics[width=\textwidth]{exp/exp3/attack_3.png}
        \subcaption{increasing bias}
        \label{attack c}
    \end{subfigure}
    \caption{Illustration of three types of attacks in our experiment} \label{attack}
\end{figure}

The following detectors and estimators are considered for comparison:
\begin{itemize}
    \item \textbf{$\chi^2$ detector }  
    calculates the probability of the Kalman residuals and compares it with a threshold $\alpha_{\text{threshold}}$:
    \begin{align}
        \chi^2_t = \|y_t - C\hat{x}_{t|t-1}\|^2_{\Sigma_{r_t}^{-1}} \ \underset{}{\overset{}{\gtrless}} \ \alpha_{\text{threshold}}.
    \end{align}
    \item \textbf{CUSUM detector }  
    computes the cumulative sum of the deviations of the Kalman residuals from a reference value $\delta_{\text{ref}}=0.5$ in a given direction:
    \begin{align}
        S_t = \max(0, S_{t-1} + (r_t - \delta_{\text{ref}})) \ \underset{}{\overset{}{\gtrless}} \ \alpha_{\text{threshold}}.
    \end{align}
    \item \textbf{Resilient estimator }  
    detects attacks by checking whether the $\chi^2$ value exceeds $\alpha_{\text{threshold}}$, and ignores the corresponding observations if so.

    \item \textbf{Gaussian-Bernoulli Secure (GBS) estimator }  
    sets the threshold $\alpha_{\text{threshold}}$ to detect low-probability events and introduces a tolerance parameter $\tau_{\text{tolerant}}$ to allow for occasional anomalies.
\end{itemize}

We choose $\alpha_{\text{threshold}} =6$ and $\tau_{\text{tolerant}}=3$ that allows each detector and estimator to achieve optimal performance. We evaluate their performance under varying attack intensities. Intensity is of particular interest to us, as there is a trade-off between the stealthiness of the attack and its impact on state estimation. As shown in Fig.~\ref{fig_11}, we select six levels of intensity for each type of attack, ranging from mild to severe. For each level, 10,000 observation sequences under attack are randomly generated.

\begin{figure}[htbp]
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{minipage}{0.47\textwidth}
            \includegraphics[width=\linewidth]{exp/exp5/random/success_rate_alpha_6_beta_3.png}
        \end{minipage}
        \begin{minipage}{0.47\textwidth}
            \includegraphics[width=\linewidth]{exp/exp5/random/estimation_error_alpha_6_beta_3.png}
        \end{minipage}
        \caption{random interference attack with different intensity}     \label{random interference}
    \end{subfigure}
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{minipage}{0.47\textwidth}
            \includegraphics[width=\linewidth]{exp/exp5/constant/success_rate_alpha_6_beta_3.png}
        \end{minipage}
        \begin{minipage}{0.47\textwidth}
            \includegraphics[width=\linewidth]{exp/exp5/constant/estimation_error_alpha_6_beta_3.png}
        \end{minipage}
        \caption{constant bias attack with different intensity}     \label{constant bias}
    \end{subfigure}
    \begin{subfigure}[b]{0.5\textwidth}
        \begin{minipage}{0.47\textwidth}
            \includegraphics[width=\linewidth]{exp/exp5/increase/success_rate_alpha_6_beta_3.png}
        \end{minipage}
        \begin{minipage}{0.47\textwidth}
            \includegraphics[width=\linewidth]{exp/exp5/increase/estimation_error_alpha_6_beta_3.png}
        \end{minipage}
        \caption{uniformly increasing bias attack with different intensity}     \label{increasing bias}
    \end{subfigure}
    \caption{Comparison of GSB Estimator's performance with other algorithms under different types of attacks and varying intensities. In the left figure, we compare the detection success rate with other algorithms. In the right figure, we compare the estimation error with other algorithms.} \label{fig_11}
\end{figure}

The results demonstrate that the detection success rate of the GBS estimator increases with the intensity of the attacks, which is intuitive. The estimation error of the GBS estimator does not continuously increase with the attack intensity; instead, it initially rises slightly and then stabilizes. Compared to other detectors and sensors, the GBS estimator generally performs better in both detection and estimation.

\subsection{Multiple Attacks in Multi-sensor System}
In multi-sensor systems, detecting attacks and ensuring resilient estimation becomes harder as more sensors are compromised. The difficulty arises from the fact that, as the volume of observations grows, malicious data can be more easily hidden among outliers—rare but significant deviations.

Consider a scalar system with $M=20$ sensors at interval $T=[0,20]$, where $x_0 \sim \mathcal{N}(0,1), A=1, Q=0.5.$
All sensors are supposed to satisfy following observation model. For each $i \in T$,
\begin{align*}
    y_{i,j} \sim \mathcal{N}(x_i, R_j = 20), \hspace{0.3cm}
        j=1,\cdots,20.
\end{align*}
Suppose we deploy noise interference on sensors indexed from $j^*=1$ to $5$. When these attacks last from $i=0$ to $20$, the actual observation model becomes:
\begin{align*}
    y_{i,j^*} \sim \mathcal{N}(x_i, \tilde{R}_{j^*} = 100), j^*=1,\cdots,5.
\end{align*}
Comparing Fig.~\ref{multi_b} and Fig.~\ref{multi_c}, their similarity illustrates that Gaussian-Bernoulli secure estimator effectively characterizes observation errors via indicators. Based on the estimated indicator sequence of each sensor, we can further distinguish attacks from outliers.

\begin{figure}[htbp]
    \centering
    % \begin{subfigure}[b]{0.45\textwidth}
    %     \centering
    %     \includegraphics[width=\textwidth]{exp/exp4/sensor_data.jpg}
    %     \subcaption{system state and multiple sensor data}
    %     \label{multi_a}
    % \end{subfigure}\\
    \begin{subfigure}[b]{0.23\textwidth}
        \centering
        \includegraphics[width=\textwidth]{exp/exp4/noise.png}
        \subcaption{observation noise map}
        \label{multi_b}
    \end{subfigure}
    \begin{subfigure}[b]{0.23\textwidth}
        \centering
        \includegraphics[width=\textwidth]{exp/exp4/indicators.png}
        \subcaption{estimated indicators map}
        \label{multi_c}
    \end{subfigure}
    \caption{Characterization the measurement error by estimated observation indicators. (a) shows the true observation errors $ \|y_{i,j}-C_jx_i\|^2_{R_j^{-1}} $, which are continuous values. Sensor $1$ to $5$, under attack, generated several observations with significant errors. (b) shows our assessment of the reliability of each observation, which is boolean.}
\end{figure}


\section{Conclusion}
We revisit the sensor attack problem from the perspective of system-environment interaction. Unlike conventional systems, interactive systems emphasize that observations not only contain information strongly correlated with the system’s internal state, but also carry information determined by the external environment. Under potential sensor attacks, an observation variable is determined by the system state during normal operation, but by the external environment when the sensor is compromised. Therefore, in interactive systems, state estimation can be viewed as the process of decoding system information, while attack detection becomes the task of decoding environmental information.

There are two main challenges in decoding such observation information. The first challenge lies in how to effectively characterize the environmental attack information, especially when the attack model is unknown, to facilitate subsequent decoding. The second challenge is that information from these two distinct sources is often entangled in a single observation variable, making it necessary to decouple them before decoding.

The central motivation and contribution of our work is to address these two challenges. First, we propose the Bernoulli-Gaussian observation model assumption, where the system’s internal information is modeled using a Gaussian distribution, and unknown environmental attacks are modeled using a Bernoulli distribution. Based on this modeling assumption, we formulate a dual-variable optimization problem to jointly infer the system state and the observation indicators. Finally, we propose the GBS estimator, an efficient algorithm capable of decoupling and decoding both the system state and the attack information from the observations.
\appendices
\section{APPENDIX}
{\small
\subsection{Proof of Lemma 1} \label{appendices:A}
Lemma 1 extends the conclusions of Kalman filtering to the optimal estimation of state sequences under partial observation sequences. 

We begin by deriving the optimal estimation based on the past observation sequences.
When the selected index set $\mathcal{O}$ is determined, each state $x_t$ corresponds to a sequence containing past observations $\mathcal{O}_t = \{i|i\in \mathcal{O}, i\le t\}$ and the estimated state $\hat{x}_{t|\mathcal{O}_t}$. Define Kalman innovation as $e_t=y_t-C\hat{x}_{t|\mathcal{O}_{t-1}}$, which can be regarded as the ``new information" about systematic randomness.

In Kalman filtering, the optimal state estimate can be calculated through the following process with $\hat{x}_{0|\emptyset} = 0$.
\begin{align}
 \left\{\begin{matrix}
    e_t = y_t-C\hat{x}_{t|\mathcal{O}_{t-1}}  \\
    \hat{x}_{t|\mathcal{O}_{t}} = \hat{x}_{t|\mathcal{O}_{t-1}} + K_te_t \\
    \hat{x}_{t+1|\mathcal{O}_t} = A \hat{x}_{t|\mathcal{O}_t} 
\end{matrix}\right.
\end{align}
where $K_t=0$ if $t \notin \mathcal{O}$.

By rewriting the Kalman filter equation as
\begin{align}
 \left\{\begin{matrix}
    \hat{x}_{t+1|\mathcal{O}_t} = A\hat{x}_{t|\mathcal{O}_{t-1}} + AK_te_t,\\
    y_t = C\hat{x}_{t|\mathcal{O}_{t-1}} + e_t,
\end{matrix}\right.  \label{a1}
\end{align}
we have another state-space model for the process $\{y_t\}$. Based on the equation (\ref{a1}),
\begin{align}
    y_t &= C(A\hat{x}_{t-1|\mathcal{O}_{t-2}} +AK_{t-1}e_{t-1}) +e_t \notag\\
        &= CA\hat{x}_{t-1|\mathcal{O}_{t-2}} + (CAK_{t-1}e_{t-1} +e_t) = \cdots \notag\\
        &= \sum_{i=0}^{t-1}CA^{t-i}K_ie_i+e_t.
\end{align}

Therefore, defining the column vector $E_{\mathcal{O}} = col\{e_0,e1,\cdots,e_N\}$, we can relate $Y$ and $E$ as $Y=L_{\mathcal{O}}E_{\mathcal{O}}$, where
\begin{align}
    L_\mathcal{O}&=\begin{bmatrix}
     I & 0 &  \cdots & 0\\
     C\Phi(1)K_{0} & I & \cdots & 0\\
     \vdots & \vdots &  \vdots & \vdots\\
     C\Phi(N)K_{0} & C\Phi(N-1)K_{1} & \cdots & I
    \end{bmatrix},
\end{align}
and $\Phi(k) = A^k$.

We note also that the inverse matrix $L^*_{\mathcal{O}}$, which satisfies $E_{\mathcal{O}} = L^*_{\mathcal{O}}Y$, can be found as
\begin{align}
    L^*_\mathcal{O}&=\begin{bmatrix}
     I & 0 &  \cdots & 0\\
     -CAK_{0} & I & \cdots & 0\\
     \vdots & \vdots &  \vdots & \vdots\\
     -C\Phi_p(N,1) K_{0} & -C\Phi_p(N,2)K_{1} & \cdots & I
    \end{bmatrix},
\end{align}
where $\Phi_p(k,j) = \prod_{i=j}^{k-1} A(I-K_iC)$.

An alternative expression of the innovation model can be obtained 
\begin{align}
    \hat{x}_{t|\mathcal{O}_t} = A\hat{x}_{t-1|\mathcal{O}_{t-1}} + K_te_t.
\end{align}
Defining the column vector $\bar{X}_{\mathcal{O}} = col\{\hat{x}_{0|\mathcal{O}_0},\hat{x}_{1|\mathcal{O}_1},\cdots,\hat{x}_{N|\mathcal{O}_N}\}$. We can relate $E_{\mathcal{O}}$ and $\bar{X}_{\mathcal{O}}$ as $\bar{X}_{\mathcal{O}} = M_{\mathcal{O}}E_{\mathcal{O}}$, where
\begin{align}
    M_\mathcal{O} &= \begin{bmatrix}
        K_{0} & 0 &  \cdots & 0\\
        \Phi(1) K_{0} & K_{1}  & \cdots & 0\\
         \vdots & \vdots &  \vdots & \vdots\\
         \Phi(N) K_{0} & \Phi(N-1) K_{1}  & \cdots &  K_{N}
        \end{bmatrix}
\end{align}

Next, we aim to switch the $\bar{X}_{\mathcal{O}}$ to $\hat{X}_{\mathcal{O}}$. For the RTS smoother provides the future information backwards,
\begin{align}
    \hat{x}_{t|\mathcal{O}} = \hat{x}_{t|\mathcal{O}_t} + F_t(\hat{x}_{t+1|\mathcal{O}}-A\hat{x}_{t|\mathcal{O}_t}),
\end{align}
we can relate $\bar{X}_{\mathcal{O}}$ and $\hat{X}_{\mathcal{O}}$ as $\hat{X}_{\mathcal{O}} = H_{\mathcal{O}}\bar{X}_{\mathcal{O}}$, where
\begin{align}
    H_\mathcal{O} &= \begin{bmatrix}
     I-F_0\Phi(N)  & \cdots & \cdots & F_0...F_{N-1}\\
     \vdots & \vdots & \vdots & \vdots\\
    0 & 0 & I-F_{N-1}\Phi(1)  & F_{N-1}\\
    0 & 0 & 0 & I
    \end{bmatrix}.
\end{align}

Ultimately, we derive the optimal linear estimate under condition $\mathcal{O}$.
\begin{align}
    \hat{X}_{\mathcal{O}} = K_{\mathcal{O}}Y = H_{\mathcal{O}}M_{\mathcal{O}}L^*_{\mathcal{O}}Y
\end{align}
Observations contribute different weight to each state estimate, with the element of matrix $K_{\mathcal{O}}$ representing the optimal allocation of weights. For those observations $\{y_t |t \notin \mathcal{O}\}$, their weights in $K_{\mathcal{O}}$ equal to $0$. As the set $\mathcal{O}$ changes, the corresponding optimal weights will also change.

\subsection{Proof of Theorem 2} \label{appendices:B}
We begin by deriving a bound on smoothness of $\phi(x)$ at which composite gradient mapping is small if primal suboptimality is small in proposition 3. Similarly, we have the result for strongly convex problems in proposition 3, which implies that a small composite gradient mapping implies a small primal suboptimality. Finally, we apply the proposition and prove the Theorem 2.

Define the composite gradient mapping as
\begin{align}
    \mathbf{D}_{\eta,g}f(x) = \frac{1}{\eta}\left( x - prox_{\eta g}(x-\eta\nabla f(x))\right).
\end{align}
and $x^+ = \text{prox}_{\eta g}(x - \eta \nabla f(x))$.

\begin{proposition}
Assume $ f(x) $ is  $ L $-smooth, and  $ g(x)  $ is  $ \lambda' $ strongly convex. Given a learning rate  $ \eta > 0 $ such that  $ \eta < \frac{2}{(L - \lambda')}$, we have
\begin{align}
\| D_{\eta, g} f(x) \|_2^2 \leq \frac{2/\eta}{2 - \eta(L - \lambda')} \left[ \phi(x) - \phi(x^+) \right].
\end{align}
\end{proposition}
Proof. Let
\begin{equation}
Q(z) = f(x) + \nabla f(x)^T (z - x) + \frac{1}{2\eta}\|z - x\|_2^2 + g(z), \label{29}
\end{equation}
then $ x^+ $ is the solution of $ \min_z Q(z) $, and $ Q(z) $ is $ (\eta^{-1} + \lambda') $ strongly convex. This implies that
\begin{equation}
Q(x) - Q(x^+) \geq \frac{\eta^{-1} + \lambda'}{2} \|x - x^+\|_2^2.
\end{equation}
Moreover, by the smoothness of \( f \), we have
\begin{align}
    \phi(x^+) &= f(x^+) + g(x^+) \notag\\
    &\leq f(x) + \nabla f(x)^T (x^+ - x) + \frac{L}{2}\|x^+ - x\|_2^2 + g(x^+)\notag\\
    &= Q(x^+) + \frac{L - \eta^{-1}}{2}\|x^+ - x\|_2^2 \notag\\
    &\leq Q(x) + \frac{L - \lambda' - 2\eta^{-1}}{2}\|x^+ - x\|_2^2 \notag\\
    &= \phi(x) + \frac{L - \lambda' - 2\eta^{-1}}{2}\|\eta D_{\eta, g} f(x) \|_2^2,
\end{align}
which implies the result.

\begin{proposition} 
Assume that $f(x)$ is an $L$-smooth convex function and $\phi(x)$ is $\lambda_{\phi}$ strongly convex. Given a learning rate $\eta > 0$, we have
\begin{align}
    \phi(x^+) \leq \phi(x_*) + \frac{(1 - \eta L)^2}{2\lambda_{\phi}} \|D_{\eta, g} f(x)\|_2^2.
\end{align}
\end{proposition}
Proof. For $ x^+ $  is the solution of (\ref{29}), we obtain the following first order condition. For all $x_*$,
\begin{align}
   [\nabla f(x) + \nabla g(x^+) + \eta^{-1}(x^+ - x)]^T (x_* - x^+) \geq 0. 
\end{align}

This implies that
\begin{align}
    &[\nabla f(x^+) + \nabla g(x^+)]^T (x_* - x^+) \notag\\
    =& [\nabla f(x^+) - \nabla f(x)]^T (x_* - x^+) \notag\\
    &+ [\nabla f(x) + \nabla g(x^+)]^T (x_* - x^+) \notag\\
    \geq & [\nabla f(x^+) - \nabla f(x)]^T (x_* - x^+) \notag\\
    &+ \eta^{-1}(x - x^+)^T (x_* - x^+) \notag\\
     = & [\nabla \tilde{f}(x^+) - \nabla \tilde{f}(x)]^T (x_* - x^+) \notag \\
    \geq  & - \|L - \eta^{-1}\| \cdot \|x^+ -x\|_2 \cdot \|x^+ -x_*\|_2, \label{33}
\end{align}
where \( \hat{f}(z) = f(z) - 0.5\eta^{-1}\|z\|_2^2 \).

Derived from the strong convexity of $\phi(x)$, we can have the following inequality.
\begin{align}
(\nabla f(x^+) + \nabla g(x^+))^T (x_* - x^+) \notag\\ \leq \phi(x_*) - \phi(x^+) - \frac{\lambda_{\phi}}{2} \|x_* - x^+\|_2^2. \label{34}
\end{align}

Taking the inequality (\ref{33}) and (\ref{34}) into consideration, we can infer that
\begin{align}
    &\phi(x_*) - \phi(x^+) \notag\\
    \geq& \inf_z \left[ \frac{\lambda_{\phi}}{2} \|z - x^+\|_2^2 - |L - \eta^{-1}| \|x^+ - x\|_2 \|x^+ - z\|_2 \right] \notag\\
    =& \frac{(\eta^{-1} - L)^2}{2\lambda_{\phi}} \|x^+ - x\|_2^2 = \frac{(1 - \eta L)^2}{2\lambda_{\phi}} \|D_{\eta, g} f(x)\|_2^2.
\end{align}

\textbf{Main Proof.} We can define
\begin{align}
    Q_t(x) = f(x_{t-1}) &+ \nabla f(x_{t-1})^T (x - x_{t-1}) \notag \\
    &+ \frac{1}{2\eta_t} \|x - x_{t-1}\|_2^2 + g(x).
\end{align}
Then $x_t = \text{prox}_{\eta_t g}(x_{t-1} - \eta_t \nabla f(x_{t-1}))$. 

Due to Proposition 2, we have the following derivation
\begin{align}
    \phi(x_t) \leq& Q_t(x_t) \leq Q_t(x) - \frac{\eta_t^{-1} + \lambda'}{2} \|x - x_t\|_2^2 \notag\\
\leq& f(x) - \frac{\lambda}{2} \|x - x_{t-1}\|_2^2 + \frac{1}{2\eta_t} \|x - x_{t-1}\|_2^2 + g(x) \notag\\
&- \frac{\eta_t^{-1} + \lambda'}{2} \|x - x_t\|_2^2 \notag\\
=& \phi(x) + \frac{1}{2} \left( \frac{1}{\eta_t} - \lambda \right) \|x - x_{t-1}\|_2^2 \notag\\ 
&- \frac{\eta_t^{-1} + \lambda'}{2} \|x - x_t\|_2^2.
\end{align}

Let $ x = x_{t-1} + \theta(\bar{x} - x_{t-1}) $ for some $ \theta \in (0, 1) $, we have
\begin{align}
&(1 - \theta)\phi(x_{t-1}) + \theta \phi(\bar{x}) - \phi(x)\notag\\
=& (1 - \theta)[\phi(x_{t-1}) - \phi(x) - \nabla \phi(x)^T (x_{t-1} - x)] \notag\\
\quad& + \theta[\phi(\bar{x}) - \phi(x) - \nabla \phi(x)^T (\bar{x} - x)] \notag\\
\geq& (1 - \theta)\frac{\lambda + \lambda'}{2} \|x_{t-1} - x\|_2^2 + \theta \frac{\lambda + \lambda'}{2} \|\bar{x} - x\|_2^2 \notag\\
=& (1 - \theta) \theta \frac{\lambda + \lambda'}{2} \|\bar{x} - x_{t-1}\|_2^2.
\end{align}

The inequality is due to the \( \lambda + \lambda' \) strong convexity of \( \phi(x) \). Therefore
\begin{align}
\phi(x_t) &\leq (1 - \theta)\phi(x_{t-1}) + \theta \phi(\bar{x})\notag\\ &\quad- \theta(1 - \theta) \frac{\lambda + \lambda'}{2} \|\bar{x} - x_{t-1}\|_2^2 \notag\\
&\quad + \frac{\theta^2}{2} \left( \frac{1}{\eta_t} - \lambda \right) \|\bar{x} - x_{t-1}\|_2^2.
\end{align}

Taking $ \eta_t = \eta $ and $ \theta = (\lambda + \lambda')/(\lambda' + \eta^{-1}) $, we obtain
\begin{align}
    \phi(x_t) \leq (1 - \theta)\phi(x_{t-1}) + \theta \phi(\bar{x}).
\end{align}
which implies the result.

\subsection{Proof of Theorem 3} \label{appendices:C}
Theorem 3 explains the relationship between the initial estimation error and the iteration number. We first investigate how the state estimation at the corresponding moment is updated when the new observation is added in Proposition 4. Based on this result, we derive the maximum number of iterations.
\begin{proposition}
    Assume that the optimal state estimation of $x_k$ under $y_{\mathcal{O}}$ is $\hat{x}_{k|\mathcal{O}}$ and the error covariance is $P_{k|\mathcal{O}}$. When the observation set changes from $y_\mathcal{O}$ to $y_\mathcal{O^*} = y_\mathcal{O} \cup \{y_{k}\}$, the optimal state estimation of $x_k$ is updated by
    \begin{align*}
        \hat{x}_{k|\mathcal{O}^*} = \hat{x}_{k|\mathcal{O}} + P_{k|\mathcal{O}}C^T(CP_{k|\mathcal{O}}C^T+R)^{-1}(y_{k}-C\hat{x}_{k|\mathcal{O}})
    \end{align*}
\end{proposition}
Proof. Denote the linear space $S_{\mathcal{O}}=Span\{y_{\mathcal{O}}\}$. Define the inner product of two random vectors as $\left \langle x,y \right \rangle = E[xy^T]$. And also define the estimation error as $\tilde{x}_{k|\mathcal{O}} = x_k-\hat{x}_{k|\mathcal{O}}$.

For $\hat{x}_{k|\mathcal{O}}$ is the optimal state estimation  under $y_{\mathcal{O}}$, it has following properties.
\begin{align}
    \hat{x}_{k|\mathcal{O}} &= \text{Proj}\{x_k|S_{\mathcal{O}}\} \\
    \hat{x}_{k|\mathcal{O}} &\perp (x_k - \hat{x}_{k|\mathcal{O}})\\ S_{\mathcal{O}} &\perp (y_{k}-C\hat{x}_{k|\mathcal{O}}) \\
    Span\{y_\mathcal{O},y_{k}\} &= Span\{y_\mathcal{O},(y_{k}-C\hat{x}_{k|\mathcal{O}})\}
\end{align}

Therefore, we can calculate the $\hat{x}_{k|\mathcal{O}^*}$ as follows:
\begin{align}
    \hat{x}_{k|\mathcal{O}^*} &= \text{Proj}\{x_k|S_{\mathcal{O}^*}\} \notag\\
    &= \text{Proj}\{x_k|S_{\mathcal{O}}\} + \text{Proj}\{x_k|(y_{k}-C \hat{x}_{k|\mathcal{O}})\} \notag\\
    &= \hat{x}_{k|\mathcal{O}} + \frac{\left \langle x_k,y_{k}-C \hat{x}_{k|\mathcal{O}} \right \rangle (y_{k}-C \hat{x}_{k|\mathcal{O}})}{\left \langle y_{k}-C \hat{x}_{k|\mathcal{O}},y_{k}-C \hat{x}_{k|\mathcal{O}} \right \rangle} \notag\\
    &= \hat{x}_{k|\mathcal{O}} + \frac{\left \langle \tilde{x}_{k|\mathcal{O}}+\hat{x}_{k|\mathcal{O}},C \tilde{x}_{k|\mathcal{O}}+v_{k} \right \rangle }{\left \langle C \tilde{x}_{k|\mathcal{O}}+v_{k},C \tilde{x}_{k|\mathcal{O}}+v_{k} \right \rangle}(y_{k}-C \hat{x}_{k|\mathcal{O}}) \notag\\
    &= \hat{x}_{k|\mathcal{O}} + \frac{\left \langle \tilde{x}_{k|\mathcal{O}},C \tilde{x}_{k|\mathcal{O}} \right \rangle}{\left \langle C \tilde{x}_{k|\mathcal{O}},C \tilde{x}_{k|\mathcal{O}} \right \rangle + \left \langle v_{k},v_{k} \right \rangle}(y_{k}-C \hat{x}_{k|\mathcal{O}}) \notag\\
    &= \hat{x}_{k|\mathcal{O}} + P_{k|\mathcal{O}}C ^T(C P_{k|\mathcal{O}}C^T +R )^{-1}(y_{k}-C\hat{x}_{k|\mathcal{O}}) \label{46}
\end{align}

\textbf{Main Proof.} Assume the $\arg\min_{\hat{x}_{0:N}} \phi_{\mathcal{O}} = \hat{x}_{0:N|\mathcal{O}}$ and $\arg\min_{\hat{x}_{0:N}} \phi_{\mathcal{O}^*} = \hat{x}_{0:N|\mathcal{O}^*}$.  The objective function with new observation $y_{k}$ can be defined as:
\begin{align}
    \phi_{\mathcal{O}^*}(\hat{x}_{0:N}) = \phi_{\mathcal{O}}(\hat{x}_{0:N}) + \|y_{k}-C \hat{x}_k\|^2_{R ^{-1}}.
\end{align}

This implies that
\begin{align}
    \phi_{\mathcal{O}^*}(\hat{x}_{0:N|\mathcal{O}})  
    =& \phi_{\mathcal{O}}(\hat{x}_{0:N|\mathcal{O}}) + \|y_{k}-C \hat{x}_{k|\mathcal{O}}\|^2_{R ^{-1}} \notag\\
    \le& \phi_{\mathcal{O}}(\hat{x}_{0:N|\mathcal{O}^*}) + \|y_{k}-C \hat{x}_{k|\mathcal{O}}\|^2_{R ^{-1}} \notag\\
    =& \phi_{\mathcal{O}}(\hat{x}_{0:N|\mathcal{O}^*}) + \|y_{k}-C (\hat{x}_{k|\mathcal{O}^*}-\Delta x_k)\|^2_{R ^{-1}} \notag\\
    \le & \phi_{\mathcal{O}}(\hat{x}_{0:N|\mathcal{O}^*}) + \|y_{k}-C \hat{x}_{k|\mathcal{O}^*}\|^2_{R ^{-1}} \notag\\
    &+\|C  \Delta x_k\|^2_{R ^{-1}} + 2 \|C  \Delta  x_k\|\|y_{k}-C \hat{x}_{k|\mathcal{O}^*}\| \notag\\
    \le & \min \phi_{\mathcal{O}^*}(\hat{x}_{0:N}) +\|C  \Delta x_k\|^2_{R ^{-1}} \notag\\
    & + 2 \|C  \Delta  x_k\|_{R ^{-1}}\|y_{k}-C \hat{x}_{k|\mathcal{O}}\|_{R ^{-1}}
\end{align}
where $\Delta x_k$ can be substituted by equation (\ref{46}).

When the initial value $\hat{X}^0 = col\{\hat{x}_{0:N|\mathcal{O}}\}$, we have
\begin{align}
    &\phi_{\mathcal{O}^*}(\hat{X}^0) - \min \phi_{\mathcal{O}^*}(\hat{X}) \notag\\ \le&  (\|C  \Delta x_k\|^2_{R ^{-1}} + 2 \|C  \Delta  x_k\|_{R ^{-1}}\|y_{k}-C \hat{x}_{k|\mathcal{O}^*}\|_{R ^{-1}})
\end{align} Based on the Theorem 2, we can imply the result.
}
% \section{}\label{appendix:bb}
% \subsection{The limitation of $\chi^2$ based method}\label{appendix B-C}
% Consider a scalar system with single sensor at interval $T=[0,20]$, where
% $x_0 \sim \mathcal{N}(0,1), A=1, C=1, Q=0.5, R=1.$ We simulate sensors in three different status, as shown in Fig.~\ref{fig.11}. 

% % The observations from sensor 3, marked as blue `$\bullet$', follow  Gaussian distribution. The observations from sensor 1, 
% % labeled as green `$\bigtriangleup$', experiences an outlier with large offset at $t=10$. The observations from sensor 2, marked as yellow `$+$', suffer from an attack with a constant bias after $t=10$.
% % Fig.~\ref{estimator} shows the state estimates calculated using the Kalman filter for the sensor data presented in Fig.~\ref{sensor_data}. In previous studies, the detector can calculate $\chi^2_t = \|y_t-C\hat{x}_{t|t-1}\|^2_{\sum_{r_t}^{-1}}$, where a larger value suggests that the observations are less reliable. In Fig.~\ref{chi}, we plot the $\chi^2_t$ sequences corresponding to the sensor data from Fig.~\ref{sensor_data}. 


% \begin{figure}[htbp]
%     \centering
%     \begin{subfigure}[b]{0.37\textwidth}
%         \centering
%         \includegraphics[width=\textwidth]{exp/exp1/sensor_data.jpg}
%         \subcaption{three different sensor status}
%         \label{sensor_data}
%     \end{subfigure}
%     \begin{subfigure}[b]{0.37\textwidth}
%         \centering
%         \includegraphics[width=\textwidth]{exp/exp1/estimator.jpg}
%         \subcaption{state estimation from different sensors}
%         \label{estimator}
%     \end{subfigure}
%     \begin{subfigure}[b]{0.37\textwidth}
%         \centering
%         \includegraphics[width=\textwidth]{exp/exp1/chi.jpg}
%         \subcaption{$\chi^2$ sequences from different sensors}
%         \label{chi}
%     \end{subfigure}
%     \caption{Illustration of the limitation of $\chi^2$ based method. (a) displays three sets of sensor data: the blue represents normal observations. Compared to the blue observation, the green shows a deviation only at $t=10$, while the yellow deviates after $t=10$. (b)(c) shows their corresponding state estimates and $\chi^2_t$  values.}
%     \label{fig.11}
% \end{figure}

% The experiment indicates that although the state estimates from Sensor 2 and Sensor 1 are very different, their $\chi^2$ curves are quite similar. This similarity arises because, after $t=10$, the state estimate from Sensor 2 becomes inaccurate, rendering the $\chi^2$ curve unreliable. Additionally, this phenomenon complicates the distinction between outliers and attacks, thus reducing the success rate of attack detection.

% \subsection{Additional experiments with different algorithm parameters} \label{appendix: B-A}
% Under different parameters, the algorithm's estimation performance is roughly the same as shown in Fig.~\ref{fig_11}. The detection success rates corresponding to different parameters are illustrated in  Fig.~\ref{fig_13}.

% \begin{figure}[htbp]
%     \begin{subfigure}[b]{0.5\textwidth}
%         \begin{minipage}{0.47\textwidth}
%             \includegraphics[width=\linewidth]{exp/exp5/random/success_rate_alpha_6_beta_2.png}
%             \caption*{$\alpha_{\text{threshold}} =6, \tau_{\text{tolerant}}=2$}
%         \end{minipage}
%         \begin{minipage}{0.47\textwidth}
%             \includegraphics[width=\linewidth]{exp/exp5/random/success_rate_alpha_6_beta_4.png}
%                         \caption*{$\alpha_{\text{threshold}} =6, \tau_{\text{tolerant}}=4$}
%         \end{minipage}
%         \caption{random interference attack with different intensity} 
%     \end{subfigure}
%     \begin{subfigure}[b]{0.5\textwidth}
%         \begin{minipage}{0.47\textwidth}
%             \includegraphics[width=\linewidth]{exp/exp5/constant/success_rate_alpha_6_beta_2.png}
%             \caption*{$\alpha_{\text{threshold}} =6, \tau_{\text{tolerant}}=2$}
%         \end{minipage}
%         \begin{minipage}{0.47\textwidth}
%             \includegraphics[width=\linewidth]{exp/exp5/constant/success_rate_alpha_6_beta_4.png}
%             \caption*{$\alpha_{\text{threshold}} =6, \tau_{\text{tolerant}}=4$}
%         \end{minipage}
%         \caption{constant bias attack with different intensity}     
%     \end{subfigure}
%     \begin{subfigure}[b]{0.5\textwidth}
%         \begin{minipage}{0.47\textwidth}
%             \includegraphics[width=\linewidth]{exp/exp5/increase/success_rate_alpha_6_beta_2.png}
%             \caption*{$\alpha_{\text{threshold}} =6, \tau_{\text{tolerant}}=2$}
%         \end{minipage}
%         \begin{minipage}{0.47\textwidth}
%             \includegraphics[width=\linewidth]{exp/exp5/increase/success_rate_alpha_6_beta_4.png}
%             \caption*{$\alpha_{\text{threshold}} =6, \tau_{\text{tolerant}}=4$}
%         \end{minipage}
%         \caption{uniformly increasing bias attack with different intensity}
%     \end{subfigure}
%     \caption{Comparison of GSB Estimator's performance with other algorithms under different types of attacks and varying intensities. In the left figure, we compare the detection success rate with other algorithms. In the right figure, we compare the estimation error with other algorithms.
%     \vspace{-15pt}
%     } \label{fig_13}
% \end{figure}


% % \subsection{An example of comparison with other detectors} \label{appendix: B-B}
% %  Here, we use a specific example to explain why GBSE performs better compared to other algorithms. To simplify the explanation, we use the data of sensor 1 and sensor 2 in Fig.\ref{sensor_data} as observations.

% % \subsubsection{$\chi^2$ detector}
% % Fig.~\ref{chi based} depicts that the biggest problem of $\chi^2$ detector is how to select an appropriate threshold. A small threshold easily mistakes outliers for attacks, while a large threshold may miss attacks.
% % \begin{figure}[htbp]
% %     \centering
% %     \begin{subfigure}[b]{0.4\textwidth}
% %         \centering
% %         \includegraphics[width=\textwidth]{exp/exp3/chi_based_detector_12.jpg}
% %     \end{subfigure}
% %     \begin{subfigure}[b]{0.4\textwidth}
% %         \centering
% %         \includegraphics[width=\textwidth]{exp/exp3/chi_based_detector_10.jpg}
% %     \end{subfigure}
% %     \caption{$\chi^2$ based estimator with different thresholds}
% %     \label{chi based}
% % \end{figure}

% % \FloatBarrier
% % \subsubsection{resilient estimator} 
% % As shown in Fig.~\ref{robust}, either tolerating abnormal observations or neglecting valid ones will both reduce the estimate performance. Therefore, how to make a trade-off in the judgment of outliers through the threshold is very challenging.
% % \begin{figure}[htbp]
% %     \centering
% %     \begin{subfigure}[b]{0.4\textwidth}
% %         \centering
% %         \includegraphics[width=\textwidth]{exp/exp3/robust_estimator_10.jpg}
% %     \end{subfigure}
% %     \begin{subfigure}[b]{0.4\textwidth}
% %         \centering
% %         \includegraphics[width=\textwidth]{exp/exp3/robust_estimator_8.jpg}
% %     \end{subfigure}
% %     \caption{resilient estimator with different thresholds}
% %     \label{robust}
% % \end{figure}

% % \subsubsection{Gaussian-Bernoulli secure estimator}
% % Fig.~\ref{GB} demonstrates that our algorithm is capable of eliminating outliers and attacks, and utilizes reliable observations to estimate states. Additionally, the experiment indicates that our method exhibits resilience when selecting the threshold.
% % \begin{figure}[htbp]
% %     \centering
% %     \begin{subfigure}[b]{0.4\textwidth}
% %         \centering
% %         \includegraphics[width=\textwidth]{exp/exp3/GB detector_10.jpg}
% %     \end{subfigure}
% %     \begin{subfigure}[b]{0.4\textwidth}
% %         \centering
% %         \includegraphics[width=\textwidth]{exp/exp3/GB detector_8.jpg}
% %     \end{subfigure}
% %     \caption{GBS estimator with different thresholds}
% %     \label{GB}
% % \end{figure}

% % One explanation for GBSE to obtain better performance is that, unlike other methods that only extract past observation information, we utilize the information from the entire observation sequence, including subsequent observations. This enhances the estimation performance of the state sequence, thereby making it easier to determine the sensor status.

% % % use section* for acknowledgment
% % \section*{Acknowledgment}
% % The authors would like to thank...
\begin{thebibliography}{10}

\bibitem{giraldo2018survey}
Jairo Giraldo, David Urbina, Alvaro Cardenas, Junia Valente, Mustafa Faisal, Justin Ruths, Nils~Ole Tippenhauer, Henrik Sandberg, and Richard Candell.
\newblock A survey of physics-based attack detection in cyber-physical systems.
\newblock {\em ACM Computing Surveys}, 51(4):1--36, 2018.

\bibitem{jensen2011model}
Jeff~C Jensen, Danica~H Chang, and Edward~A Lee.
\newblock A model-based design methodology for cyber-physical systems.
\newblock In {\em IEEE Proceedings of the 7th International Wireless Communications and Mobile Computing Conference}, pages 1666--1671, 2011.

\bibitem{zhou2024cybersecurity}
Jing Zhou, Jun Shang, and Tongwen Chen.
\newblock Cybersecurity landscape on remote state estimation: A comprehensive review.
\newblock {\em IEEE/CAA Journal of Automatica Sinica}, 11(4):851--865, 2024.

\bibitem{chen2017applications}
Hong Chen.
\newblock Applications of cyber-physical system: a literature review.
\newblock {\em Journal of Industrial Integration and Management}, 2(03):1750012, 2017.

\bibitem{yu2016smart}
Xinghuo Yu and Yusheng Xue.
\newblock Smart grids: A cyber--physical systems perspective.
\newblock {\em Proceedings of the IEEE}, 104(5):1058--1070, 2016.

\bibitem{zhang2022advancements}
Kunwu Zhang, Yang Shi, Stamatis Karnouskos, Thilo Sauter, Huazhen Fang, and Armando~Walter Colombo.
\newblock Advancements in industrial cyber-physical systems: An overview and perspectives.
\newblock {\em IEEE Transactions on Industrial Informatics}, 19(1):716--729, 2022.

\bibitem{ren2025high}
Yunxiao Ren, Weiming Liu, Silong Wang, Guannan Lv, and Guanghui Wen.
\newblock High-accuracy tracking control for uncertain robot manipulators: a sparse online gaussian process approach.
\newblock {\em Robotic Intelligence and Automation}, 45(2):273--282, 2025.

\bibitem{he2016cyber}
Haibo He and Jun Yan.
\newblock Cyber-physical attacks and defences in the smart grid: a survey.
\newblock {\em IET Cyber-Physical Systems: Theory \& Applications}, 1(1):13--27, 2016.

\bibitem{kim2021cybersecurity}
Kyounggon Kim, Jun~Seok Kim, Seonghoon Jeong, Jo-Hee Park, and Huy~Kang Kim.
\newblock Cybersecurity for autonomous vehicles: Review of attacks and defense.
\newblock {\em Computers \& Security}, 103:102150, 2021.

\bibitem{ruegamer2015jamming}
Alexander Ruegamer, Dirk Kowalewski, et~al.
\newblock Jamming and spoofing of {GNSS} signals--an underestimated risk?!
\newblock {\em Proc. Wisdom Ages Challenges Modern World}, 3:17--21, 2015.

\bibitem{hartmann2013vulnerability}
Kim Hartmann and Christoph Steup.
\newblock The vulnerability of uavs to cyber attacks-an approach to the risk assessment.
\newblock In {\em IEEE Proceedings of the 5th International Conference on Cyber Conflict}, pages 1--23, 2013.

\bibitem{mo2010false}
Yilin Mo and Bruno Sinopoli.
\newblock False data injection attacks in control systems.
\newblock In {\em Proceedings of the 1st Workshop on Secure Control Systems}, volume~1, 2010.

\bibitem{ren2024optimal}
Yunxiao Ren, Zhisheng Duan, Jiashun Guan, Weiming Liu, and Yicheng Lin.
\newblock Optimal {DoS} attacks on remote state estimation with continuous action spaces.
\newblock In {\em 2024 IEEE International Conference on Unmanned Systems (ICUS)}, pages 1153--1158. IEEE, 2024.

\bibitem{guo2016optimal}
Ziyang Guo, Dawei Shi, Karl~Henrik Johansson, and Ling Shi.
\newblock Optimal linear cyber-attack on remote state estimation.
\newblock {\em IEEE Transactions on Control of Network Systems}, 4(1):4--13, 2016.

\bibitem{zhang2015optimal1}
Heng Zhang, Peng Cheng, Ling Shi, and Jiming Chen.
\newblock Optimal denial-of-service attack scheduling with energy constraint.
\newblock {\em IEEE Transactions on Automatic Control}, 60(11):3023--3028, 2015.

\bibitem{mo2013detecting}
Yilin Mo, Rohan Chabukswar, and Bruno Sinopoli.
\newblock Detecting integrity attacks on scada systems.
\newblock {\em IEEE Transactions on Control Systems Technology}, 22(4):1396--1407, 2013.

\bibitem{zhou2023optimal}
Jing Zhou, Jun Shang, and Tongwen Chen.
\newblock Optimal deception attacks on remote state estimators equipped with interval anomaly detectors.
\newblock {\em Automatica}, 148:110723, 2023.

\bibitem{yang2023lasso}
Nachuan Yang, Zikai Wang, Tianci Yang, Yuzhe Li, and Ling Shi.
\newblock {LASSO}-based detection and identification of actuator integrity attacks in remote control systems.
\newblock {\em IEEE Transactions on Control Systems Technology}, 32(2):696--704, 2023.

\bibitem{zhu2015game}
Quanyan Zhu and Tamer Basar.
\newblock Game-theoretic methods for robustness, security, and resilience of cyberphysical control systems: games-in-games principle for optimal cross-layer resilient control systems.
\newblock {\em IEEE Control Systems Magazine}, 35(1):46--65, 2015.

\bibitem{li2016sinr}
Yuzhe Li, Daniel~E Quevedo, Subhrakanti Dey, and Ling Shi.
\newblock {SINR}-based {DoS} attack on remote state estimation: A game-theoretic approach.
\newblock {\em IEEE Transactions on Control of Network Systems}, 4(3):632--642, 2016.

\bibitem{meira2021synthesis}
R{\^o}mulo Meira-G{\'o}es, St{\'e}phane Lafortune, and Herv{\'e} Marchand.
\newblock Synthesis of supervisors robust against sensor deception attacks.
\newblock {\em IEEE Transactions on Automatic Control}, 66(10):4990--4997, 2021.

\bibitem{fu2024distributed}
Xingquan Fu, Guanghui Wen, Mengfei Niu, and Wei~Xing Zheng.
\newblock Distributed secure filtering against eavesdropping attacks in {SINR}-based sensor networks.
\newblock {\em IEEE Transactions on Information Forensics and Security}, 19:3483--3494, 2024.

\bibitem{mo2015physical2}
Yilin Mo, Sean Weerakkody, and Bruno Sinopoli.
\newblock Physical authentication of control systems: Designing watermarked control inputs to detect counterfeit sensor outputs.
\newblock {\em IEEE Control Systems Magazine}, 35(1):93--109, 2015.

\bibitem{kogiso2015cyber}
Kogiso Kiminao and T.~Fujita.
\newblock Cyber-security enhancement of networked control systems using homomorphic encryption.
\newblock In {\em IEEE Proceedings of the 54th Conference on Decision and Control}, pages 6836--6843, 2015.

\bibitem{shang2020optimal}
Jun Shang, Maoyin Chen, and Tongwen Chen.
\newblock Optimal linear encryption against stealthy attacks on remote state estimation.
\newblock {\em IEEE Transactions on Automatic Control}, 66(8):3592--3607, 2020.

\bibitem{shang2022single}
Jun Shang, Jing Zhou, and Tongwen Chen.
\newblock Single-dimensional encryption against innovation-based stealthy attacks on remote state estimation.
\newblock {\em Automatica}, 136:110015, 2022.

\bibitem{shang2025stealthy}
Jun Shang, Yuzhe Li, and Tongwen Chen.
\newblock Stealthy attacks on sampled-data control and encryption-based countermeasures.
\newblock {\em IEEE Transactions on Automatic Control}, 2025.

\bibitem{lin2018tabor}
Qin Lin, Sridha Adepu, Sicco Verwer, and Aditya Mathur.
\newblock Tabor: A graphical model-based approach for anomaly detection in industrial control systems.
\newblock In {\em Proceedings of the Asia Conference on Computer and Communications Security}, pages 525--536, 2018.

\bibitem{goh2017anomaly}
Jonathan Goh, Sridhar Adepu, Marcus Tan, and Zi~Shan Lee.
\newblock Anomaly detection in cyber physical systems using recurrent neural networks.
\newblock In {\em IEEE 18th International Symposium on High Assurance Systems Engineering}, pages 140--145, 2017.

\bibitem{wang2019deep}
Huaizhi Wang, Jiaqi Ruan, Zhengwei Ma, Bin Zhou, Xueqian Fu, and Guangzhong Cao.
\newblock Deep learning aided interval state prediction for improving cyber security in energy internet.
\newblock {\em Energy}, 174:1292--1304, 2019.

\bibitem{koley2021catch}
Ipsita Koley, Sunandan Adhikary, and Soumyajit Dey.
\newblock Catch me if you learn: Real-time attack detection and mitigation in learning enabled {CPS}.
\newblock In {\em 2021 IEEE Real-Time Systems Symposium (RTSS)}, pages 136--148. IEEE, 2021.

\bibitem{mo2014secure}
Yilin Mo and Bruno Sinopoli.
\newblock Secure estimation in the presence of integrity attacks.
\newblock {\em IEEE Transactions on Automatic Control}, 60(4):1145--1151, 2014.

\bibitem{chang2018secure}
Young~Hwan Chang, Qie Hu, and Claire~J Tomlin.
\newblock Secure estimation based {Kalman} filter for cyber--physical systems against sensor attacks.
\newblock {\em Automatica}, 95:399--412, 2018.

\bibitem{wang2018robust}
Hongwei Wang, Hongbin Li, Jun Fang, and Heping Wang.
\newblock Robust {Gaussian} {Kalman} filter with outlier detection.
\newblock {\em IEEE Signal Processing Letters}, 25(8):1236--1240, 2018.

\bibitem{wen2023joint}
Guanghui Wen, Yuezu Lv, Wei~Xing Zheng, Jialing Zhou, and Junjie Fu.
\newblock Joint robustness of time-varying networks and its applications to resilient consensus.
\newblock {\em IEEE Transactions on Automatic Control}, 68(11):6466--6480, 2023.

\bibitem{li2024secure}
Zishuo Li and Yilin Mo.
\newblock Secure distributed dynamic state estimation against sparse integrity attack via distributed convex optimization.
\newblock {\em IEEE Transactions on Automatic Control}, 69(9):6089--6104, 2024.

\end{thebibliography}