feat: Time dependent Wick theorem. (#274)

feat: Proof of the time-dependent Wick's theorem
This commit is contained in:
Joseph Tooby-Smith 2025-01-20 15:17:48 +00:00 committed by GitHub
parent 4d43698b3c
commit 17f84b7153
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 8563 additions and 3329 deletions

View file

@ -53,12 +53,24 @@ def expectedHepLeanImports : IO (Array Name) := do
needed.push root
pure needed
def listDif : (a: List String) → (b : List String) → (List String × List String)
| [], [] => ([], [])
| a :: as, [] => (a :: as, [])
| [], b :: bs => ([], b :: bs)
| a :: as, b :: bs =>
if a = b then listDif as bs
else (a :: (listDif as bs).1, b :: (listDif as bs).2)
/-- Checks whether an array `imports` is sorted after `Init` is removed. -/
def arrayImportSorted (imports : Array Import) : IO Bool := do
let X := (imports.map (fun x => x.module.toString)).filter (fun x => x != "Init")
let mut warned := false
if ! X = X.qsort (· < ·) then
IO.print s!"Import file is not sorted. \n"
let ldif := listDif X.toList (X.qsort (· < ·)).toList
let lzip := List.zip ldif.1 ldif.2
let lstring := String.intercalate "\n" (lzip.map (fun x => s!"{x.1} > {x.2}"))
println! lstring
warned := true
pure warned