Skip to content

feat(QuantumInfo): Bloch sphere + solid angle definitions for Pancharatnam#1126

Merged
jstoobysmith merged 5 commits into
leanprover-community:masterfrom
Xylem-Group:pancharatnam
May 28, 2026
Merged

feat(QuantumInfo): Bloch sphere + solid angle definitions for Pancharatnam#1126
jstoobysmith merged 5 commits into
leanprover-community:masterfrom
Xylem-Group:pancharatnam

Conversation

@wock9000
Copy link
Copy Markdown
Contributor

@wock9000 wock9000 commented May 26, 2026

Summary

Adds QuantumInfo/Finite/GeometricPhase/BlochSphere.lean (108 lines, zero sorry) — the Bloch sphere type and API for qubit geometric phase.

Definitions

  • BlochSphere: the unit sphere Metric.sphere 0 1 in EuclideanSpace ℝ (Fin 3)
  • blochPoint α θ: a point on the Bloch sphere from polar and azimuthal angles, with a proof of unit norm
  • solidAngle p₁ p₂ p₃: solid angle of a geodesic triangle on the Bloch sphere via the Van Vleck formula, using Complex.arg for full-quadrant support

Results

  • blochVecRaw_norm: the raw Bloch vector satisfies sin²α(cos²θ + sin²θ) + cos²α = 1
  • dot_blochPoint: dot product of two Bloch points in terms of angle differences

All definitions operate on BlochSphere points rather than raw vectors. Uses Mathlib's dotProduct and crossProduct.

Builds on the merged BargmannInvariant.lean (#1121).

@wock9000
Copy link
Copy Markdown
Contributor Author

t-quantum-mechanics

namespace GeometricPhase

/-! ## Bloch sphere coordinates for qubits -/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be nice here to define a type for the Bloch sphere, maybe using e.g. EuclideanGeometry.Sphere

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably rename this BlochSphere, as this is seems to me as an API around that

@wock9000
Copy link
Copy Markdown
Contributor Author

Both addressed in the latest push:

  1. Renamed to BlochSphere.lean — the file is Bloch sphere infrastructure; Pancharatnam's theorem will come in a follow-up once this API is in place.

  2. Added BlochSphere type as a def for Metric.sphere (0 : EuclideanSpace ℝ (Fin 3)) 1. The blochVec function returns the raw vector; a blochPoint constructor returning a sphere member can be added once we prove ‖blochVec α θ‖ = 1 (straightforward via sin²+cos²=1, deferred to keep this PR focused). Happy to add the norm proof here if you'd prefer.

82 lines, zero sorry, all lints pass.


/-- The Bloch vector for polar angle `α` and azimuthal angle `θ`,
as a raw vector in ℝ³. -/
def blochVec (α θ : ℝ) : Fin 3 → ℝ :=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should redefine these (where possible) in terms of BlochSphere how.

@wock9000
Copy link
Copy Markdown
Contributor Author

Rebuilt the API around BlochSphere. All definitions now take/return sphere points:

  • blochPoint α θ : BlochSphere constructs a sphere member with a norm proof (sin²α(cos²θ + sin²θ) + cos²α = 1)
  • solidAngle takes three BlochSphere points
  • dot_blochPoint operates on sphere points
  • blochVecRaw is private — internal to the blochPoint constructor

108 lines, zero sorry, all lints pass.

jstoobysmith
jstoobysmith previously approved these changes May 27, 2026
Copy link
Copy Markdown
Member

@jstoobysmith jstoobysmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - approved. Will merge shortly

@wock9000
Copy link
Copy Markdown
Contributor Author

thanks Joseph, appreciated

/-! ## The Bloch sphere -/

/-- The Bloch sphere: unit sphere in `EuclideanSpace ℝ (Fin 3)`. -/
abbrev BlochSphere := Metric.sphere (0 : EuclideanSpace ℝ (Fin 3)) 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually before merging can we move this out of the namespace and change the namespace to BlochSphere rather then GeometricPhase

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — BlochSphere is now defined outside the namespace (top-level), and the namespace is BlochSphere rather than GeometricPhase. So the API is BlochSphere.blochPoint, BlochSphere.solidAngle, etc.

wock9000 added 5 commits May 28, 2026 02:18
…atnam

Adds QuantumInfo/Finite/GeometricPhase/Pancharatnam.lean (91 lines, zero sorry):
- blochVector: unit vector on S² parameterized by (α, θ)
- dot3, cross3, tripleProduct: ℝ³ vector operations
- solidAngle: Van Vleck formula via Complex.arg (full quadrant support)
- dot3_blochVector: dot product in terms of angle differences (proved)

Builds on the merged BargmannInvariant.lean. The Re/Im trig identities
and the Pancharatnam theorem itself will follow in a subsequent PR
(keeping each under 100 lines per review guidelines).
Adds QuantumInfo/Finite/GeometricPhase/Pancharatnam.lean (72 lines, zero sorry):
- blochVector: unit vector on S² from angles (α, θ)
- solidAngle: Van Vleck formula via Complex.arg (full quadrant support)
- dot_blochVector: dot product in terms of angle differences (proved)

Uses Mathlib's dotProduct and crossProduct — no redefined ℝ³ operations.
All lints pass (sorry_lint, runPhyslibLinters, codespell, style).
Renamed Pancharatnam.lean → BlochSphere.lean per review — this file
is Bloch sphere infrastructure, not the theorem itself.

Added BlochSphere def as Metric.sphere (0 : EuclideanSpace ℝ (Fin 3)) 1.
blochVec returns raw vector; blochPoint constructor with norm proof
deferred to keep PR focused.

82 lines, zero sorry, all lints pass.
All definitions now use BlochSphere (Metric.sphere 0 1) rather than
raw Fin 3 → ℝ vectors:
- blochPoint α θ : BlochSphere (with norm proof via sin²+cos²=1)
- solidAngle takes BlochSphere points, not angle pairs
- dot_blochPoint operates on sphere points

blochVecRaw is private — internal to the blochPoint constructor.

108 lines, zero sorry, all lints pass.
Copy link
Copy Markdown
Member

@jstoobysmith jstoobysmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@jstoobysmith jstoobysmith added the ready-to-merge This PR is approved and will be merged shortly label May 28, 2026
@jstoobysmith jstoobysmith merged commit f59106d into leanprover-community:master May 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is approved and will be merged shortly t-quantum-mechanics Quantum mechanics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants