Merge pull request #165 from HEPLean/informal_defs

docs: Add clusters to informal graph
This commit is contained in:
Joseph Tooby-Smith 2024-09-21 14:52:39 -04:00 committed by GitHub
commit 24af48623c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 73 additions and 22 deletions

View file

@ -9,7 +9,7 @@ import HepLean.Meta.Informal
# The Pati-Salam Model
The Pati-Salam model is a grand unified theory that unifies the Standard Model gauge group into
The Pati-Salam model is a petite unified theory that unifies the Standard Model gauge group into
`SU(4) x SU(2) x SU(2)`.
This file current contains informal-results about the Pati-Salam group.
@ -27,13 +27,24 @@ informal_definition GaugeGroupI where
math :≈ "The group `SU(4) x SU(2) x SU(2)`."
physics :≈ "The gauge group of the Pati-Salam model (unquotiented by ℤ₂)."
informal_definition embedSM where
physics :≈ "The embedding of the Standard Model gauge group into the Pati-Salam gauge group."
informal_definition inclSM where
physics :≈ "The homomorphism of the Standard Model gauge group into the Pati-Salam gauge group."
math :≈ "The group homomorphism `SU(3) x SU(2) x U(1) -> SU(4) x SU(2) x SU(2)`
taking (h, g, α) to (blockdiag (α h, α ^ (-3)), g, diag(α ^ (3), α ^(-3)))."
ref :≈ "Page 54 of https://math.ucr.edu/home/baez/guts.pdf"
deps :≈ [``GaugeGroupI, ``StandardModel.GaugeGroupI]
informal_lemma inclSM_ker where
math :≈ "The kernel of the map ``inclSM is equal to the subgroup
``StandardModel.gaugeGroup₃SubGroup."
ref :≈ "Footnote 10 of https://arxiv.org/pdf/2201.07245"
deps :≈ [``inclSM, ``StandardModel.gaugeGroup₃SubGroup]
informal_definition embedSM₃ where
math :≈ "The group embedding from ``StandardModel.GaugeGroup₃ to ``GaugeGroupI
induced by ``inclSM by quotienting by the kernal ``inclSM_ker."
deps :≈ [``inclSM, ``StandardModel.GaugeGroup₃, ``GaugeGroupI, ``inclSM_ker]
informal_definition gaugeGroupISpinEquiv where
math :≈ "The equivalence between `GaugeGroupI` and `Spin(6) × Spin(4)`."
deps :≈ [``GaugeGroupI]
@ -54,12 +65,12 @@ informal_definition GaugeGroup₂ where
informal_lemma sm_₆_factor_through_gaugeGroup₂SubGroup where
math :≈ "The group ``StandardModel.gaugeGroup₆SubGroup under the homomorphism ``embedSM factors
through the subgroup ``gaugeGroup₂SubGroup."
deps :≈ [``embedSM, ``StandardModel.gaugeGroup₆SubGroup, ``gaugeGroup₂SubGroup]
deps :≈ [``inclSM, ``StandardModel.gaugeGroup₆SubGroup, ``gaugeGroup₂SubGroup]
informal_definition embedSM₆To₂ where
math :≈ "The group homomorphism from ``StandardModel.GaugeGroup₆ to ``GaugeGroup
induced by ``embedSM."
deps :≈ [``embedSM, ``StandardModel.GaugeGroup₆, ``GaugeGroup₂,
deps :≈ [``inclSM, ``StandardModel.GaugeGroup₆, ``GaugeGroup₂,
``sm_₆_factor_through_gaugeGroup₂SubGroup]
end PatiSalam

View file

@ -20,13 +20,18 @@ informal_definition GaugeGroupI where
math :≈ "The group `Spin(10)`."
physics :≈ "The gauge group of the Spin(10) model (aka SO(10)-model.)"
informal_definition embedPatiSalam where
physics :≈ "The embedding of the Pati-Salam gauge group into Spin(10)."
informal_definition inclPatiSalam where
physics :≈ "The inclusion of the Pati-Salam gauge group into Spin(10)."
math :≈ "The lift of the embedding `SO(6) x SO(4) → SO(10)` to universal covers,
giving a homomorphism `Spin(6) x Spin(4) → Spin(10)`. Precomposed with the isomorphism,
``PatiSalam.gaugeGroupISpinEquiv,
between `SU(4) x SU(2) x SU(2)` and `Spin(6) x Spin(4)`."
``PatiSalam.gaugeGroupISpinEquiv, between `SU(4) x SU(2) x SU(2)` and `Spin(6) x Spin(4)`."
ref :≈ "Page 56 of https://math.ucr.edu/home/baez/guts.pdf"
deps :≈ [``GaugeGroupI, ``PatiSalam.GaugeGroupI, ``PatiSalam.gaugeGroupISpinEquiv]
informal_definition inclSM where
physics :≈ "The inclusion of the Standard Model gauge group into Spin(10)."
math :≈ "The compoisiton of ``embedPatiSalam and ``PatiSalam.inclSM."
ref :≈ "Page 56 of https://math.ucr.edu/home/baez/guts.pdf"
deps :≈ [``inclPatiSalam, ``PatiSalam.inclSM]
end Spin10Model

View file

@ -203,36 +203,55 @@ section dotFile
-/
/-- Turns a formal definition or lemma into a node of a dot graph. -/
def formalToNode (d : Name) : MetaM String := do
def formalToNode (nameSpaces : Array Name) (d : Name) : MetaM String := do
let lineNo ← getLineNumber d
let mod ← getModule d
let webPath := "https://github.com/HEPLean/HepLean/blob/master/"++
(mod.toString.replace "." "/") ++ ".lean"
let docstring ← getDocString d
pure s!"\"{d}\"[label=\"{d}\", shape=box, style=filled, fillcolor=steelblue,
let prefixName := if nameSpaces.contains d then d else
d.getPrefix
let nodeStr := s!"\"{d}\"[label=\"{d}\", shape=box, style=filled, fillcolor=steelblue,
href=\"{webPath}#L{lineNo}\", tooltip=\"{docstring}\"]"
if prefixName = Lean.Name.anonymous then
pure nodeStr
else
pure ("subgraph cluster_" ++ prefixName.toString.replace "." "_" ++ " { " ++ nodeStr ++ "; }")
unsafe def informalLemmaToNode (c : Import × ConstantInfo) : MetaM String := do
unsafe def informalLemmaToNode (nameSpaces : Array Name) (c : Import × ConstantInfo) : MetaM String := do
let lineNo ← getLineNumber c.2.name
let webPath := "https://github.com/HEPLean/HepLean/blob/master/"++
(c.1.module.toString.replace "." "/") ++ ".lean"
let informalLemma ← (constantInfoToInformalLemma c.2)
pure s!"\"{c.2.name}\"[label=\"{c.2.name}\", shape=ellipse, style=filled, fillcolor=lightgray,
let prefixName := if nameSpaces.contains c.2.name then c.2.name else
c.2.name.getPrefix
let nodeStr := s!"\"{c.2.name}\"[label=\"{c.2.name}\", shape=ellipse, style=filled, fillcolor=lightgray,
href=\"{webPath}#L{lineNo}\", tooltip=\"{informalLemma.math}\"]"
if prefixName = Lean.Name.anonymous then
pure nodeStr
else
pure ("subgraph cluster_" ++ prefixName.toString.replace "." "_" ++ " { " ++ nodeStr ++ "; }")
unsafe def informalDefToNode (c : Import × ConstantInfo) : MetaM String := do
unsafe def informalDefToNode (nameSpaces : Array Name) (c : Import × ConstantInfo) : MetaM String := do
let lineNo ← getLineNumber c.2.name
let webPath := "https://github.com/HEPLean/HepLean/blob/master/"++
(c.1.module.toString.replace "." "/") ++ ".lean"
let informalDef ← (constantInfoToInformalDefinition c.2)
pure s!"\"{c.2.name}\"[label=\"{c.2.name}\", shape=box, style=filled, fillcolor=lightgray,
let prefixName := if nameSpaces.contains c.2.name then c.2.name else
c.2.name.getPrefix
let nodeStr := s!"\"{c.2.name}\"[label=\"{c.2.name}\", shape=box, style=filled, fillcolor=lightgray,
href=\"{webPath}#L{lineNo}\", tooltip=\"{informalDef.math}\"]"
if prefixName = Lean.Name.anonymous then
pure nodeStr
else
pure ("subgraph cluster_" ++ prefixName.toString.replace "." "_" ++ " { " ++ nodeStr ++ "; }")
unsafe def informalToNode (c : Import × ConstantInfo) : MetaM String := do
unsafe def informalToNode (nameSpaces : Array Name) (c : Import × ConstantInfo) : MetaM String := do
if Informal.isInformalLemma c.2 then
informalLemmaToNode c
informalLemmaToNode nameSpaces c
else if Informal.isInformalDef c.2 then
informalDefToNode c
informalDefToNode nameSpaces c
else
pure ""
@ -256,17 +275,32 @@ unsafe def informalToEdges (c : Import × ConstantInfo) : MetaM (String) := do
else
pure ""
unsafe def namespaceToCluster (name : Name) : MetaM String := do
let nameUnder := name.toString.replace "." "_"
if name = Lean.Name.anonymous then
pure ""
else
pure ("subgraph cluster_" ++ nameUnder ++ "
{
label=\"" ++ name.toString ++ "\";
color=steelblue;
}")
unsafe def mkDot (imports : Array Import) : MetaM String := do
let informal ← imports.mapM importToInformal
let informal := informal.flatten
let deps ← (informal.map (fun c => c.2)).mapM informalDependencies
let deps := deps.flatten
let informal_name := informal.map (fun c => c.2.name)
let informalNameSpaces := informal.map fun c => c.2.name.getPrefix
let clusters ← informalNameSpaces.mapM fun c => namespaceToCluster c
let clusters := String.intercalate "\n" clusters.toList.eraseDups
let formal_deps := deps.filter (fun d => d ∉ informal_name)
let formal_nodes ← formal_deps.mapM formalToNode
let formal_nodes ← formal_deps.mapM (formalToNode informalNameSpaces)
let nodes := String.intercalate "\n" formal_nodes.toList
let informalLemmaNodes ← informal.mapM informalToNode
let informalNodes := String.intercalate "\n" informalLemmaNodes.toList
let informalNodes ← informal.mapM (informalToNode informalNameSpaces)
let informalNodes := String.intercalate "\n" informalNodes.toList
let edges ← informal.mapM informalToEdges
let edges := String.intercalate "\n" edges.toList
let header := "strict digraph G {
@ -283,7 +317,8 @@ unsafe def mkDot (imports : Array Import) : MetaM String := do
labeljust=\"l\";
edge [arrowhead=vee];"
let footer := "}"
pure (header ++ "\n" ++ nodes ++ "\n" ++ informalNodes ++ "\n" ++ edges ++ "\n" ++ footer)
pure (header ++ "\n" ++clusters ++ "\n" ++ nodes ++ "\n" ++
informalNodes ++ "\n" ++ edges ++ "\n" ++ footer)
end dotFile