Theory Functional_Calculus_Overview

(*  Title:   Functional_Calculus_Overview.thy
    Author:  Dustin Bryant
*)

theory Functional_Calculus_Overview
  imports
    Hermitian_Functional_Calculus
    Matrix_Sums
    Trotter_Product_Formula
    Suzuki_Order
    Suzuki_Error
begin

section ‹Overview›

text ‹The entry has five parts.
▪ \texttt{Hermitian\_Functional\_Calculus}: $g(A)$ for Hermitian $A$ (‹mat_fun_eigen›,
  ‹mat_fun_decomp›), its algebra ($g(A)h(A)=(gh)(A)$, $g(A)^*=\bar g(A)$, linearity, powers,
  composition), unitarity, time evolution, and the inverse (‹herm_inv›).
▪ \texttt{Matrix\_Sums}: finite sums of matrices.
▪ \texttt{Trotter\_Product\_Formula}: the Lie--Trotter formula with error bound (‹trotter›).
▪ \texttt{Suzuki\_Order}: Suzuki's recursion and its order conditions (‹suzuki_order›).
▪ \texttt{Suzuki\_Error}: the error of a product formula (‹formula_product_approx›,
  ‹suzuki_error›).›

section ‹Using the entry›

text ‹For a Hermitian $A\in M_n$ (‹A ∈ carrier_mat n n› and ‹hermitian A›) and a function
$g:\R\to\C$, ‹mat_fun g A› is $g(A)$.
▪ Computing $g(A)$: on eigenvectors (‹mat_fun_eigen›), from a spectral decomposition
  (‹spectral_decomp_exists›, ‹mat_fun_decomp›), or entrywise for real diagonal matrices
  (‹mat_fun_diag›).  It exists and is unique (‹mat_fun_unique›); to show that a given matrix is
  $g(A)$, use ‹mat_fun_eqI›.
▪ Algebra: ‹mat_fun_add›, ‹mat_fun_smult›, ‹mat_fun_mult›, ‹mat_fun_pow›,
  ‹mat_fun_comp›, ‹mat_fun_dagger›, ‹mat_fun_hermitian›, ‹mat_fun_unitary›, and
  ‹mat_fun_cong› (only the values on the spectrum matter).
▪ ‹evolution A t› is $e^{itA}$ and ‹herm_inv A› is $A^{-1}$.
▪ ‹U ≈η V› says $\norm{Uv-Vv}\le\eta\norm v$ for all $v$; the product formulas
  (‹trotter›, ‹suzuki_error›) are stated with it.›

text ‹Matrices are those of Jordan\_Normal\_Form, with the adjoint $M^\dagger$ and ‹unitary› of
Isabelle\_Marries\_Dirac and ‹hermitian› of QHLProver.  The theories hide Isabelle\_Marries\_Dirac's
gate constants ‹X›, ‹Y›, ‹Z›, ‹H›, ‹S›, ‹T› (still available as ‹Quantum.X› etc.), so
that these letters can name matrices.›

subsection ‹Examples›

text ‹The evolution under $Z=\diag(1,-1)$ is $e^{itZ}=\diag(e^{it},e^{-it})$:›

lemma example_evolution_Z: "evolution (diag_matrix [1, -1]) t = diag_matrix [cis t, cis (- t)]"
proof -
  have "evolution (diag_matrix (map complex_of_real [1, -1])) t = diag_matrix (map (λx. cis (t * x)) [1, -1])"
    unfolding evolution_def by (rule mat_fun_diag)
  thus ?thesis by simp
qed

text ‹The inverse of $\diag(2,4)$ is $\diag(\tfrac12,\tfrac14)$:›

lemma example_inverse: "herm_inv (diag_matrix [2, 4]) = diag_matrix [1/2, 1/4]"
proof -
  have "herm_inv (diag_matrix (map complex_of_real [2, 4])) = diag_matrix (map (λx. complex_of_real (inverse x)) [2, 4])"
    unfolding herm_inv_def by (rule mat_fun_diag)
  thus ?thesis by (simp add: inverse_eq_divide)
qed

end