{-# OPTIONS --safe --cubical-compatible --guardedness --exact-split --double-check #-}
module ALMA.Physics.Spacetime.LorentzGroup where
open import Data.Rational using (ℚ; 0ℚ; 1ℚ; _+_; _*_; _-_; _/_; -_)
open import Data.Rational.Tactic.RingSolver using (solve)
open import Data.Rational.Properties using (*-identityˡ)
open import Data.Integer using (+_)
open import Data.List using (_∷_; [])
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality using
(_≡_; refl; cong; trans; module ≡-Reasoning)
open import ALMA.Physics.Spacetime.LorentzForm using (FourVec; mk4; g)
open FourVec using (t; x; y; z)
IsLorentz : (FourVec → FourVec) → Set
IsLorentz A = ∀ v w → g (A v) (A w) ≡ g v w
id4 : FourVec → FourVec
id4 v = v
id-lorentz : IsLorentz id4
id-lorentz v w = refl
comp-lorentz : ∀ A B → IsLorentz A → IsLorentz B →
IsLorentz (A ∘ B)
comp-lorentz A B pA pB v w =
trans (pA (B v) (B w)) (pB v w)
boost : ℚ → ℚ → FourVec → FourVec
boost a b v =
mk4 (a * t v + b * x v)
(b * t v + a * x v)
(y v) (z v)
g-boost-raw : ∀ a b tv xv yv zv tw xw yw zw →
((a * tv + b * xv) * (a * tw + b * xw)
- (b * tv + a * xv) * (b * tw + a * xw)
- yv * yw - zv * zw)
≡ (a * a - b * b) * (tv * tw - xv * xw) - yv * yw - zv * zw
g-boost-raw a b tv xv yv zv tw xw yw zw =
solve ( a ∷ b ∷ tv ∷ xv ∷ yv ∷ zv ∷ tw ∷ xw ∷ yw ∷ zw ∷ [])
boost-lorentz : ∀ a b → a * a - b * b ≡ 1ℚ → IsLorentz (boost a b)
boost-lorentz a b eq v w =
let open ≡-Reasoning
tx = t v * t w - x v * x w
in begin
g (boost a b v) (boost a b w)
≡⟨ g-boost-raw a b (t v) (x v) (y v) (z v) (t w) (x w) (y w) (z w) ⟩
(a * a - b * b) * tx - y v * y w - z v * z w
≡⟨ cong (λ c → c * tx - y v * y w - z v * z w) eq ⟩
1ℚ * tx - y v * y w - z v * z w
≡⟨ cong (λ c → c - y v * y w - z v * z w) (*-identityˡ tx) ⟩
tx - y v * y w - z v * z w ∎
neg-square : ∀ b → (0ℚ - b) * (0ℚ - b) ≡ b * b
neg-square b = solve (b ∷ [])
boost-inv-lorentz : ∀ a b → a * a - b * b ≡ 1ℚ →
IsLorentz (boost a (0ℚ - b))
boost-inv-lorentz a b eq =
boost-lorentz a (0ℚ - b)
(trans (cong (λ c → a * a - c) (neg-square b)) eq)
fifth : ℚ
fifth = + 5 / 4
threeq : ℚ
threeq = + 3 / 4
point-eq : fifth * fifth - threeq * threeq ≡ 1ℚ
point-eq = refl
boost5-lorentz : IsLorentz (boost fifth threeq)
boost5-lorentz = boost-lorentz fifth threeq point-eq