Kebab is a opensource simulation framework for quantum computation written in Julia language.Kebab aims to realize quantum algorithm simulation in different level(eg.hardware level/software level/...) under different computation model and provide useful support for experiments.

Cause the framework is based on quantum circuit. All the operations are written into a quantum-gate-like module. And quantum circuit looks like a kebab.

Julia is a fast and effient dynamic language support lots of modern technologies. eg. cothread,distribution computation,cloud computation...

Kebab have serveral functions at present

- qunatum circuit simulation
- basic quantum gates,eg. Hadamard gate,Pauli gates,C-NOT...
- adiabatic quantum computation simulation
- deamo-like cooling module
- quantum fourier transformation

- quantum error correction
- Shor algorithm
- one-way computation model
- topological quantum computation
- performance optimization
- quantum circuit optimization
- quantum deep learning
- ...

The Exact Cover problem is about a sequence of clause for n-bits

*C*_{1} ∧ *C*_{2} ∧ …*C*_{M}

each clauses involves 3 bits,and the question is what kind of value can these n bits satisfy this sequence of clause?

First a Hamiltonian can be constructed as following: *H*(*s*)=(1 − *s*)*H*_{B} + *s* ⋅ *H*_{P} 0 ≤ *s* ≤ 1

where,

$$
H_B^{(i)} = \frac{1}{2}(1-\sigma_{x}^{(i)})\quad with\quad \sigma_x^{(i)}=\begin{pmatrix}
0 & 1\\
1 & 0
\end{pmatrix}
$$

*H*_{B} = ∑*H*_{B}^{(i)}

*H*_{P, C}(|*z*_{1}⟩|*z*_{2}⟩⋯|*z*_{n}⟩) = *h*_{C}(*z*_{iC}, *z*_{jC}, *z*_{kC})|*z*_{1}⟩|*z*_{2}⟩⋯|*z*_{n}⟩

The function *h*_{C} is called cost function

for example,

$$
h_C = \begin{cases}
0 \quad \text{if the clause is satisfied}\\
1 \quad \text{if the clause is violated}
\end{cases}
$$

whose concept is actually the same with classical search algorithms.

According to the adiabatic theorm, if the evolution is slow enough,the ground state can be kept during the evolution.

take s as t/T,where t is the current time and T is the evolution time. *H* = (1 − *t*/*T*)*H*_{B} + *t*/*T* ⋅ *H*_{P}

H is actually *H*_{B},and the ground state of *H*_{B} is designed to Bell state.

H becomes *H*_{P}, and we get the ground state of *H*_{P}, which is the answer to a given problem.Even the problem does not actually have an answer, the algorithm can find the best-match answer.

by this APIs offered by Kebab.We can easily simulate how a adiabatic quanutm computer work on a 3-EC problem.

```
H = AdiaSystem([TruthTable(0b10010111,[1,2,3]),
TruthTable(0b10010111,[2,3,4]),
TruthTable(0b10010111,[3,4,5]),
TruthTable(0b10010111,[5,6,7]),
TruthTable(0b10010111,[1,5,6]),
TruthTable(0b10010111,[2,3,6]),
],7,1e3)
```

`eigens = TimeEvoModule!(state,Hs,1;dt=1e-2)`

There's a big flaw of adiabatic computation model. The eigen energy of Hamiltonian should not cross during the evolution, or the result cannot be garanteed as ground state.

We use the cooling module near places that ground state is close to other eigen values.To help it keep ground state.

For a time reason, We do not test other condition.

Quantum circuit computation is an important model in quantum computation.

Kebab offers single qubit gates and double qubit control gates.

some commonly used gates have already have wrappers,eg.

```
#Hadamard gate
function Hadamard(state::AbstractVector,ID::Integer)
#Controled R_k gate
function C_R_k(
state::AbstractVector,
CID::Integer,UCID::Integer,
k::Integer
)
```

we use this two gates to build the quantum circuit of quantum fourier transformation

```
function SingleQubitQFT!(state::AbstractVector,bitID::Integer)
state_len = length(state)
bit_num = Int(log2(state_len))
@assert bitID<=bit_num "bit ID out of bounds"
copy!(state,Hadamard(state,bitID))
for i=1:(bitID-1)
copy!(state,C_R_k(state,bitID-i,bitID,i))
end
return state
end
```

```
function QFT!(state::AbstractVector)
state_len = length(state)
bit_num = Int(log2(state_len))
i = bit_num
while i>0
SingleQubitQFT!(state,i)
i-=1
end
return state
end
```