-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProperties.lean
More file actions
143 lines (118 loc) · 3.93 KB
/
Copy pathProperties.lean
File metadata and controls
143 lines (118 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import QuantumComputing.Gates.Basic
/-!
# Gate Properties
Unitary, self-adjoint, and involutive facts for the named gates.
-/
namespace QuantumComputing
theorem X_isUnitary : Matrix.isUnitary X := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, X, _root_.Matrix.mul_apply, Fin.sum_univ_two]
theorem Z_isUnitary : Matrix.isUnitary Z := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, Z, _root_.Matrix.mul_apply, Fin.sum_univ_two]
theorem H_isUnitary : Matrix.isUnitary H := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, H, _root_.Matrix.mul_apply, Fin.sum_univ_two]
theorem CNOT_isUnitary : Matrix.isUnitary CNOT := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, CNOT, _root_.Matrix.mul_apply, Fin.sum_univ_four] <;>
decide
theorem TOFFOLI_isUnitary : Matrix.isUnitary TOFFOLI := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, TOFFOLI, _root_.Matrix.mul_apply,
Fin.sum_univ_eight] <;>
decide
theorem CZ_isUnitary : Matrix.isUnitary CZ := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, CZ, _root_.Matrix.mul_apply, Fin.sum_univ_four] <;>
decide
theorem SWAP_isUnitary : Matrix.isUnitary SWAP := by
rw [Matrix.isUnitary_iff_adjoint_mul_self]
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Matrix.adjoint, SWAP, _root_.Matrix.mul_apply, Fin.sum_univ_four] <;>
decide
@[simp]
theorem X_adjoint : X† = X := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, X]
@[simp]
theorem Z_adjoint : Z† = Z := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, Z]
@[simp]
theorem H_adjoint : H† = H := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, H]
@[simp]
theorem CNOT_adjoint : CNOT† = CNOT := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, CNOT]
@[simp]
theorem TOFFOLI_adjoint : TOFFOLI† = TOFFOLI := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, TOFFOLI]
@[simp]
theorem CZ_adjoint : CZ† = CZ := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, CZ]
@[simp]
theorem SWAP_adjoint : SWAP† = SWAP := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.adjoint, SWAP]
@[simp]
theorem X_mul_self : X ⬝ X = I 2 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, X, _root_.Matrix.mul_apply, Fin.sum_univ_two]
@[simp]
theorem Z_mul_self : Z ⬝ Z = I 2 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, Z, _root_.Matrix.mul_apply, Fin.sum_univ_two]
@[simp]
theorem H_mul_self : H ⬝ H = I 2 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, H, _root_.Matrix.mul_apply, Fin.sum_univ_two]
@[simp]
theorem CNOT_mul_self : CNOT ⬝ CNOT = I 4 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, CNOT, _root_.Matrix.mul_apply, Fin.sum_univ_four] <;> decide
@[simp]
theorem TOFFOLI_mul_self : TOFFOLI ⬝ TOFFOLI = I 8 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, TOFFOLI, _root_.Matrix.mul_apply, Fin.sum_univ_eight] <;>
decide
@[simp]
theorem CZ_mul_self : CZ ⬝ CZ = I 4 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, CZ, _root_.Matrix.mul_apply, Fin.sum_univ_four] <;> decide
@[simp]
theorem SWAP_mul_self : SWAP ⬝ SWAP = I 4 := by
ext i j
fin_cases i <;> fin_cases j <;>
norm_num [Matrix.mul, SWAP, _root_.Matrix.mul_apply, Fin.sum_univ_four] <;> decide
end QuantumComputing