# Optimal Opacity-Enforcing Supervisory Control of Discrete Event Systems on Choosing Cost
## 6 Scenario 2: Secret \(K\) Is Not Opaque with Respect to \(L(G)\) and \(\Sigma_{a}\)
Secondly, we show that closed-loop behavior \(L(f/G)\) produced by Algorithm 7 is a feasible solution of Model (1). 1. Showing the opacity of \(L(f/G)\). In Lines 3-5, it is obvious that \(K^{\prime}\) is opaque with respect to \(L(G^{\prime})\) and \(\Sigma_{a}\). At Lines 6-14, by Theorems 2-4, it holds that \(K^{\prime}\) is opaque with respect to \(L(f^{\prime}/G^{\prime})\) and \(\Sigma_{a}\), which implies that \(\theta(K^{\prime}\cap L(f^{\prime}/G^{\prime}))\subseteq\theta(L(f^{\prime}/G^ {\prime})-K^{\prime})\). According to Lines 4, 5, and 15, we have \(\theta(K\cap L(f/G))\subseteq\theta(L(f/G)-K\cap L(g/G))\). Since \(L(f/G)\subseteq L(g/G)\), we have \(\theta(L(f/G)-K\cap L(g/G))\subseteq\theta(L(f/G)-K\cap L(f/G))\). So, \(\theta(K\cap L(f/G))\subseteq\theta(L(f/G)-K\cap L(f/G))\) holds, which means \(\theta(K\cap L(f/G))\subseteq\theta(L(f/G)-K)\) is true. Therefore, \(K\) is opaque with respect to \(L(f/G)\) and \(\Sigma_{a}\). 2. Showing that closed-loop behavior \(L(f/G)\) can preserve the maximal secret information. For system \(G^{\prime}\) and secret \(K^{\prime}\), at Lines 4-14, it is obvious that \(L(f^{\prime}/G^{\prime})\) is a feasible solution of Model (2), which implies that \(\overline{K^{\prime}}\subseteq L(f^{\prime}/G^{\prime})\). Since \(K\cap L(g/G)=K^{\prime}\) at Line 5 and \(L(f/G)=L(f^{\prime}/G^{\prime})\) at Line 15, it holds that \(K\cap L(g/G)\subseteq L(f/G)\), which implies that \(K\cap L(g/G)\subseteq K\cap L(f/G)\). Since \(L(f^{\prime}/G^{\prime})\subseteq L(G^{\prime})\) holds, it is true that \(L(f/G)\subseteq L(g/G)\). So, we have \(K\cap L(f/G)\subseteq K\cap L(g/G)\). Therefore, we have \(K\cap L(f/G)=K\cap L(g/G)\). To conclude, closed-loop behavior \(L(f/G)\) produced by Algorithm 7 is a feasible solution of Model (1). Finally, we show that the discount total choosing cost of \(L(f/G)\) produced by Algorithm 7 is minimal for Model (1). We assume that closed-loop behavior \(L(f/G)\) produced by Algorithm 7 is not the optimal solution of Model (1). So, there exists supervisor \(f_{1}\) such that \(L(f_{1}/G)\) is a feasible solution of Model (1) and \(V(L(f_{1}/G))<V(L(f/G))\) holds. For Model (1), the two constrain conditions are satisfied for \(L(f_{1}/G)\). The two conditions mean that \(K\cap L(f_{1}/G)\) is opaque with respect to \(L(f_{1}/G)\) and \(\Sigma_{a}\), and \(K\cap L(f_{1}/G)=K\cap L(g/G)\) holds. As shown in Line 5, we have \(K^{\prime}=K\cap L(f_{1}/G)\). Taking \(G_{1}=f_{1}/G\), it holds that \(\overline{K^{\prime}}\subseteq L(G_{1})\). Based on the assumption about \(L(f_{1}/G)\) and \(L(g/G)\), we have \(L(f_{1}/G)\subseteq L(g/G)\). Then, we consider the following two cases:  
**Case 1**: If \(L(f_{1}/G)=L(g/G)\), we discuss the relation between \(\overline{K^{\prime}}\) and \(L(G_{1})\). **1.1**: If \(\overline{K^{\prime}}=L(G_{1})\), it holds that \(L(f_{1}/G)=L(f/G)\) at Lines 6 and 7, which contracts with the assumption that \(V(L(f_{1}/G))<V(L(f/G))\). **1.2**: If \(\overline{K^{\prime}}\subset L(G_{1})\), it holds that \(V(L(f/G))\leq V(L(f_{1}/G))\) by Theorems 3 and 4 at Lines 9-13, which contracts with the assumption that \(V(L(f_{1}/G))<V(L(f/G))\). **Case 2**: If \(L(f_{1}/G)\subset L(g/G)\), it is true that \(s\
ot\in\overline{K^{\prime}}\) for any \(s\in L(g/G)-L(f_{1}/G)\) because of formulas \(\overline{K^{\prime}}\subseteq L(G_{1})\) and \(L(f_{1}/G)=L(G_{1})\), which implies that \(s\) is out of \(\overline{K^{\prime}}\). Then, we discuss the relation between \(\overline{K^{\prime}}\) and \(L(G_{1})\) again. **2.1**: If \(\overline{K^{\prime}}=L(G_{1})\), there exists \(s^{\prime}\in\overline{K^{\prime}}-K^{\prime}\) such that \(\theta(s)=\theta(s^{\prime})\) for any \(s\in K^{\prime}\), which means that all the secret strings in \(K^{\prime}\) can be confused by the non-secret string in \(\overline{K^{\prime}}\). By Corollary 2, it holds that \(V(L(f_{1}/G))=V(\overline{K^{\prime}})\). In Lines 9 and 10, it is true that \(V(L(f/G))=V(\overline{K^{\prime}})\).