Dataset Viewer
Auto-converted to Parquet Duplicate
fact
stringlengths
19
8.26k
type
stringclasses
8 values
library
stringclasses
2 values
imports
listlengths
0
7
filename
stringclasses
397 values
symbolic_name
stringlengths
1
73
docstring
stringlengths
20
499
addModulesIn (recurse : Bool) (prev : Array Name) (root : Name := .anonymous) (path : FilePath) : IO (Array Name) := do let mut r := prev for entry in ← path.readDir do if ← entry.path.isDir then if recurse then r ← addModulesIn recurse r (root.mkStr entry.fileName) entry.path else let .some mod := FilePath.fileStem en...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/check_file_imports.lean
addModulesIn
/-- Recursively finds files in directory. -/
expectedPhysLeanImports : IO (Array Name) := do let mut needed := #[] for top in ← FilePath.readDir "PhysLean" do let nm := `PhysLean let rootname := FilePath.withExtension top.fileName "" let root := nm.mkStr rootname.toString if ← top.path.isDir then needed ← addModulesIn (recurse := true) needed (root := root) top.p...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/check_file_imports.lean
expectedPhysLeanImports
/-- Compute imports expected by `PhysLean.lean` by looking at file structure. -/
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 `I...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/check_file_imports.lean
listDif
null
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 ...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/check_file_imports.lean
arrayImportSorted
/-- Checks whether an array `imports` is sorted after `Init` is removed. -/
checkMissingImports (modData : ModuleData) (reqImports : Array Name) : IO Bool := do let names : Std.HashSet Name := Std.HashSet.ofArray (modData.imports.map (·.module)) let mut warned := false let nameArray := reqImports.filterMap ( fun req => if !names.contains req then some req else none) if nameArray.size ≠ 0 then ...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/check_file_imports.lean
checkMissingImports
/-- Checks every file in `reqImports` is imported into `modData` return true if this is NOT the case. -/
main (_ : List String) : IO UInt32 := do initSearchPath (← findSysroot) let mods : Name := `PhysLean let imp : Import := {module := mods} let mFile ← findOLean imp.module unless (← mFile.pathExists) do throw <| IO.userError s!"object file '{mFile}' of module {imp.module} does not exist" let (hepLeanMod, _) ← readModule...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/check_file_imports.lean
main
null
PhysLeanTODOItem : Type := Array String → Array (String × ℕ) /-- Checks if a . -/
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
PhysLeanTODOItem
/-- Given a list of lines, outputs an error message and a line number. -/
TODOFinder : PhysLeanTODOItem := fun lines ↦ Id.run do let enumLines := (lines.toList.enumFrom 1) let todos := enumLines.filterMap (fun (lno1, l1) ↦ if l1.startsWith "/-! TODO:" then some ((l1.replace "/-! TODO: " "").replace "-/" "", lno1) else none) todos.toArray
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
TODOFinder
/-- Checks if a . -/
TODOContext where /-- The underlying `message`. -/ statement : String /-- The line number -/ lineNumber : ℕ /-- The file path -/ path : FilePath
structure
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
TODOContext
/-- Checks if a . -/
printTODO (todos : Array TODOContext) : IO Unit := do for e in todos do IO.println (s!"{e.path}:{e.lineNumber}: {e.statement}")
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
printTODO
/-- The file path -/
filePathToGitPath (S : FilePath) (n : ℕ) : String := "https://github.com/HEPLean/PhysLean/blob/master/"++ (S.toString.replace "." "/").replace "/lean" ".lean" ++ "#L" ++ toString n
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
filePathToGitPath
/-- The file path -/
docTODO (todos : Array TODOContext) : IO String := do let mut out := "" for e in todos do out := out ++ (s!" - [{e.statement}]("++ filePathToGitPath e.path e.lineNumber ++ ")\n") return out
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
docTODO
/-- The file path -/
hepLeanLintFile (path : FilePath) : IO String := do let lines ← IO.FS.lines path let allOutput := (Array.map (fun lint ↦ (Array.map (fun (e, n) ↦ TODOContext.mk e n path)) (lint lines))) #[TODOFinder] let errors := allOutput.flatten printTODO errors docTODO errors
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
hepLeanLintFile
null
todoFileHeader : String := s!" # TODO List This is an automatically generated list of TODOs appearing as `/-! TODO:...` in PhysLean. Please feel free to contribute to the completion of these tasks. "
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
todoFileHeader
null
main (args : List String) : IO UInt32 := do initSearchPath (← findSysroot) let mods : Name := `PhysLean let imp : Import := {module := mods} let mFile ← findOLean imp.module unless (← mFile.pathExists) do throw <| IO.userError s!"object file '{mFile}' of module {imp.module} does not exist" let (hepLeanMod, _) ← readMod...
def
scripts
[ "import Lean", "import Batteries.Data.String.Matcher", "import Mathlib.Data.Nat.Notation" ]
scripts/find_TODOs.lean
main
null
main (args : List String) : IO UInt32 := do println! "\x1b[36m(1/7) Style lint \x1b[0m" println! "\x1b[2mThis linter is not checked by GitHub but if you have time please fix these errors.\x1b[0m" let styleLint ← IO.Process.output {cmd := "lake", args := #["exe", "style_lint"]} println! styleLint.stdout println! "\x1b[3...
def
scripts
[]
scripts/lint_all.lean
main
null
lintStyleCli (args : Cli.Parsed) : IO UInt32 := do let mode : OutputSetting := match (args.hasFlag "update", args.hasFlag "github") with | (true, _) => OutputSetting.update | (false, true) => OutputSetting.print ErrorFormat.github | (false, false) => OutputSetting.print ErrorFormat.humanReadable let mut allModules := #...
def
scripts
[ "import Mathlib.Tactic.Linter.TextBased", "import Cli.Basic" ]
scripts/mathlib_textLint_on_hepLean.lean
lintStyleCli
/-- Implementation of the `lint_style` command line program. -/
heplean_lint_style : Cmd := `[Cli| lint_style VIA lintStyleCli; ["0.0.1"] "Run text-based style linters on every Lean file in PhysLean (adapted from mathlib's lint_style). Print errors about any unexpected style errors to standard output." FLAGS: github; "Print errors in a format suitable for github problem matchers\n\...
def
scripts
[ "import Mathlib.Tactic.Linter.TextBased", "import Cli.Basic" ]
scripts/mathlib_textLint_on_hepLean.lean
heplean_lint_style
/-- Setting up command line options and help text for `lake exe lint_style`. -/
main (args : List String) : IO UInt32 := do heplean_lint_style.validate args
def
scripts
[ "import Mathlib.Tactic.Linter.TextBased", "import Cli.Basic" ]
scripts/mathlib_textLint_on_hepLean.lean
main
/-- The entry point to the `lake exe mathlib_textLint_on_hepLean` command. -/
getDocString (constName : Array ConstantInfo) : MetaM String := do let env ← getEnv let mut docString := "" for c in constName do if ¬ Lean.Name.isInternalDetail c.name then let doc ← Lean.findDocString? env c.name match doc with | some x => docString := docString ++ "- " ++ x ++ "\n" | none => docString := docString r...
def
scripts
[ "import Batteries.Lean.IO.Process", "import Lean", "import Lean.Parser", "import Lean.Data.Json", "import Mathlib.Lean.CoreM", "import LLM.GPT.Json", "import LLM.GPT.API" ]
scripts/openAI_doc_check.lean
getDocString
null
header : String := " Answer as if you an expert mathematician, physicist and software engineer. Below I have listed the doc strings of definitions and theorems in a Lean 4 file. Output a list of 1) spelling mistakes. 2) grammatical errors. 3) suggestions for improvement. Note that text within `...` should be treated as...
def
scripts
[ "import Batteries.Lean.IO.Process", "import Lean", "import Lean.Parser", "import Lean.Data.Json", "import Mathlib.Lean.CoreM", "import LLM.GPT.Json", "import LLM.GPT.API" ]
scripts/openAI_doc_check.lean
header
null
main (args : List String) : IO UInt32 := do initSearchPath (← findSysroot) let firstArg := args.head? match firstArg with | some x => do let mut imp : Import := Import.mk x.toName false if x == "random" then let mods : Name := `PhysLean let imps : Import := {module := mods} let mFile ← findOLean imps.module unless (← m...
def
scripts
[ "import Batteries.Lean.IO.Process", "import Lean", "import Lean.Parser", "import Lean.Data.Json", "import Mathlib.Lean.CoreM", "import LLM.GPT.Json", "import LLM.GPT.API" ]
scripts/openAI_doc_check.lean
main
null
getStats : MetaM String := do let noDefsVal ← noDefs let noLemmasVal ← noLemmas let noImportsVal ← noImports let noDefsNoDocVal ← noDefsNoDocString let noLemmasNoDocVal ← noLemmasNoDocString let noLinesVal ← noLines let noInformalLemmasVal ← noInformalLemmas let s := s!" Number of Files 📄: {noImportsVal} Number of lin...
def
scripts
[ "import PhysLean.Meta.Informal.Post", "import Mathlib.Lean.CoreM" ]
scripts/stats.lean
getStats
null
Stats.toHtml : MetaM String := do let noDefsVal ← noDefs let noLemmasVal ← noLemmas let noImportsVal ← noImports let noDefsNoDocVal ← noDefsNoDocString let noLemmasNoDocVal ← noLemmasNoDocString let noLinesVal ← noLines let noInformalDefsVal ← noInformalDefs let noInformalLemmasVal ← noInformalLemmas let noTODOsVal ← n...
def
scripts
[ "import PhysLean.Meta.Informal.Post", "import Mathlib.Lean.CoreM" ]
scripts/stats.lean
Stats.toHtml
null
main (args : List String) : IO UInt32 := do let _ ← noImports let statString ← CoreM.withImportModules #[`PhysLean] (getStats).run' println! statString if "mkHTML" ∈ args then let html ← CoreM.withImportModules #[`PhysLean] (Stats.toHtml).run' let htmlFile : System.FilePath := {toString := "./docs/Stats.html"} IO.FS.wr...
def
scripts
[ "import PhysLean.Meta.Informal.Post", "import Mathlib.Lean.CoreM" ]
scripts/stats.lean
main
null
baseHtmlGenerator (title : String) (site : Array Html) : BaseHtmlM Html := do let moduleConstant := if let some module := ← getCurrentName then #[<script>{.raw s!"const MODULE_NAME={String.quote module.toString};"}</script>] else #[] pure <html lang="en"> <head> [← baseHtmlHeadDeclarations] <title>{title}</title> <scri...
def
scripts
[ "import DocGen4.Output.ToHtmlFormat", "import DocGen4.Output.Navbar" ]
scripts/Template.lean
baseHtmlGenerator
/-- The HTML template used for all pages. -/
baseHtml (title : String) (site : Html) : BaseHtmlM Html := baseHtmlGenerator title #[site]
def
scripts
[ "import DocGen4.Output.ToHtmlFormat", "import DocGen4.Output.Navbar" ]
scripts/Template.lean
baseHtml
/-- A comfortability wrapper around `baseHtmlGenerator`. -/
IsUpperCamal (s : String) : Bool := let parts := s.splitOn "." let lastPart := parts.get! (parts.length - 1) lastPart = "noConfusionType" ∨ (¬ (lastPart.get 0 ≥ 'A' ∧ lastPart.get 0 ≤ 'z')) ∨ (lastPart.get 0 ≥ 'A' ∧ lastPart.get 0 ≤ 'Z')
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/type_former_lint.lean
IsUpperCamal
/-- A rough definition of Upper Camal, checking that if a string starts with a latin letter then that letter is capital. -/
main (_ : List String) : IO UInt32 := do initSearchPath (← findSysroot) let mods : Name := `PhysLean let imp : Import := {module := mods} let mFile ← findOLean imp.module unless (← mFile.pathExists) do throw <| IO.userError s!"object file '{mFile}' of module {imp.module} does not exist" let (hepLeanMod, _) ← readModule...
def
scripts
[ "import Batteries.Lean.HashSet", "import Lean" ]
scripts/type_former_lint.lean
main
/-- A rough definition of Upper Camal, checking that if a string starts with a latin letter then that letter is capital. -/
eulerLagrangeOp (L : Time → X → X → ℝ) (q : Time → X) : Time → X := fun t => gradient (L t · (∂ₜ q t)) (q t) - ∂ₜ (fun t' => gradient (L t' (q t') ·) (∂ₜ q t')) t
def
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/EulerLagrange.lean
eulerLagrangeOp
/-- The Euler Lagrange operator, for a trajectory `q : Time → X`, and a lagrangian `Time → X → X → ℝ`, the Euler-Lagrange operator is `∂L/∂q - dₜ(∂L/∂(dₜ q))`. -/
eulerLagrangeOp_eq (L : Time → X → X → ℝ) (q : Time → X) : eulerLagrangeOp L q = fun t => gradient (L t · (∂ₜ q t)) (q t) - ∂ₜ (fun t' => gradient (L t' (q t') ·) (∂ₜ q t')) t := by rfl
lemma
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/EulerLagrange.lean
eulerLagrangeOp_eq
/-- The Euler Lagrange operator, for a trajectory `q : Time → X`, and a lagrangian `Time → X → X → ℝ`, the Euler-Lagrange operator is `∂L/∂q - dₜ(∂L/∂(dₜ q))`. -/
eulerLagrangeOp_zero (q : Time → X) : eulerLagrangeOp (fun _ _ _ => 0) q = fun _ => 0 := by simp [eulerLagrangeOp_eq, Time.deriv_eq] /- The variational derivative of `L t (q' t) (deriv q' t))` for a lagrangian `L` is equal to the `eulerLagrangeOp`. -/
lemma
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/EulerLagrange.lean
eulerLagrangeOp_zero
null
euler_lagrange_varGradient (L : Time → X → X → ℝ) (q : Time → X) (hq : ContDiff ℝ ∞ q) (hL : ContDiff ℝ ∞ ↿L) : (δ (q':=q), ∫ t, L t (q' t) (fderiv ℝ q' t 1)) = eulerLagrangeOp L q := by rw [eulerLagrangeOp_eq] simp only [Time.deriv_eq] apply HasVarGradientAt.varGradient apply HasVarGradientAt.intro _ · apply HasVarAdj...
theorem
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/EulerLagrange.lean
euler_lagrange_varGradient
null
hamiltonEqOp (H : Time → X → X → ℝ) (p : Time → X) (q : Time → X) : Time → X × X := fun t => (∂ₜ q t + -gradient (fun x => H t x (q t)) (p t), - ∂ₜ p t + -gradient (fun x => H t (p t) x) (q t))
def
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/HamiltonsEquations.lean
hamiltonEqOp
/-- Given a hamiltonian `H : Time → X → X → ℝ` the operator which when set to zero implies the Hamilton equations. -/
hamiltonEqOp_eq (H : Time → X → X → ℝ) (p : Time → X) (q : Time → X) : hamiltonEqOp H p q = fun t => (∂ₜ q t + -gradient (fun x => H t x (q t)) (p t), - ∂ₜ p t + -gradient (fun x => H t (p t) x) (q t)) := by rfl
lemma
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/HamiltonsEquations.lean
hamiltonEqOp_eq
/-- Given a hamiltonian `H : Time → X → X → ℝ` the operator which when set to zero implies the Hamilton equations. -/
hamiltonEqOp_eq_zero_iff_hamiltons_equations (H : Time → X → X → ℝ) (p : Time → X) (q : Time → X) : hamiltonEqOp H p q = 0 ↔ (∀ t, ∂ₜ q t = gradient (fun x => H t x (q t)) (p t)) ∧ (∀ t, ∂ₜ p t = -gradient (fun x => H t (p t) x) (q t)) := by simp [hamiltonEqOp_eq] simp_all only [Time.deriv_eq] rw [funext_iff] simp_all ...
lemma
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/HamiltonsEquations.lean
hamiltonEqOp_eq_zero_iff_hamiltons_equations
null
hamiltons_equations_varGradient (H : Time → X → X → ℝ) (pq : Time → X × X) (hp : ContDiff ℝ ∞ pq) (hL : ContDiff ℝ ∞ ↿H) : (δ (pq':= pq), ∫ t, ⟪(pq' t).1, ∂ₜ (Prod.snd ∘ pq') t⟫_ℝ - H t (pq' t).1 (pq' t).2) = fun t => hamiltonEqOp H (fun t => (pq t).1) (fun t => (pq t).2) t := by apply HasVarGradientAt.varGradient appl...
theorem
PhysLean
[ "import PhysLean.Mathematics.VariationalCalculus.HasVarGradient" ]
PhysLean/ClassicalMechanics/HamiltonsEquations.lean
hamiltons_equations_varGradient
null
ElectricField (d : ℕ := 3) := Time → Space d → EuclideanSpace ℝ (Fin d) /-- The magnetic field is a map from `d+1` dimensional spacetime to the vector space `ℝ^d`. -/
abbrev
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
ElectricField
/-- The electric field is a map from `d`+1 dimensional spacetime to the vector space `ℝ^d`. -/
MagneticField (d : ℕ := 3) := Time → Space d → EuclideanSpace ℝ (Fin d) open IndexNotation open realLorentzTensor /-- The vector potential of an electromagnetic field-/
abbrev
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
MagneticField
/-- The magnetic field is a map from `d+1` dimensional spacetime to the vector space `ℝ^d`. -/
VectorPotential (d : ℕ := 3) := SpaceTime d → ℝT[d, .up] /-- The electric permittivity and the magnetic permeability of free space. -/
abbrev
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
VectorPotential
/-- The vector potential of an electromagnetic field-/
EMSystem where /-- The permittivity of free space. -/ ε₀ : ℝ /-- The permeability of free space. -/ μ₀ : ℝ TODO "6V2UZ" "Charge density and current density should be generalized to signed measures, in such a way that they are still easy to work with and can be integrated with with tensor notation. See here: https://lea...
structure
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
EMSystem
/-- The electric permittivity and the magnetic permeability of free space. -/
ChargeDensity := Time → Space → ℝ /-- Current density. -/
abbrev
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
ChargeDensity
/-- The charge density. -/
CurrentDensity := Time → Space → EuclideanSpace ℝ (Fin 3) namespace EMSystem variable (𝓔 : EMSystem) open SpaceTime /-- The speed of light. -/
abbrev
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
CurrentDensity
/-- Current density. -/
c : ℝ := 1/(√(𝓔.μ₀ * 𝓔.ε₀)) /-- Coulomb's constant. -/
def
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
c
/-- The speed of light. -/
coulombConstant : ℝ := 1/(4 * Real.pi * 𝓔.ε₀)
def
PhysLean
[ "import PhysLean.SpaceAndTime.SpaceTime.Basic" ]
PhysLean/Electromagnetism/Basic.lean
coulombConstant
/-- Coulomb's constant. -/
fderiv_uncurry (f : X → Y → Z) (xy dxy : X × Y) (hf : DifferentiableAt 𝕜 (↿f) xy) : fderiv 𝕜 ↿f xy dxy = fderiv 𝕜 (f · xy.2) xy.1 dxy.1 + fderiv 𝕜 (f xy.1 ·) xy.2 dxy.2 := by have hx : (f · xy.2) = ↿f ∘ (fun x' => (x',xy.2)) := by rfl have hy : (f xy.1 ·) = ↿f ∘ (fun y' => (xy.1,y')) := by rfl rw [hx,hy] repeat rw ...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry
null
fderiv_curry_fst (f : X × Y → Z) (x : X) (y : Y) (h : DifferentiableAt 𝕜 f (x,y)) (dx : X) : fderiv 𝕜 (fun x' => Function.curry f x' y) x dx = fderiv 𝕜 f (x,y) (dx, 0) := by have h1 : f = ↿(Function.curry f) := by ext x rfl conv_rhs => rw [h1] rw [fderiv_uncurry] simp only [Function.curry_apply, map_zero, add_zero] ...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_fst
null
fderiv_curry_snd (f : X × Y → Z) (x : X) (y : Y) (h : DifferentiableAt 𝕜 f (x,y)) (dy : Y) : fderiv 𝕜 (Function.curry f x) y dy = fderiv 𝕜 (f) (x,y) (0, dy) := by have h1 : f = ↿(Function.curry f) := by ext x rfl conv_rhs => rw [h1] rw [fderiv_uncurry] simp rfl exact h
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_snd
null
fderiv_uncurry_clm_comp (f : X → Y → Z) (hf : Differentiable 𝕜 (↿f)) : fderiv 𝕜 ↿f = fun xy => (fderiv 𝕜 (f · xy.2) xy.1).comp (ContinuousLinearMap.fst 𝕜 X Y) + (fderiv 𝕜 (f xy.1 ·) xy.2).comp (ContinuousLinearMap.snd 𝕜 X Y) := by funext xy apply ContinuousLinearMap.ext intro dxy rw [fderiv_uncurry] simp only [Co...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_clm_comp
null
fderiv_wrt_prod {f : X × Y → Z} {xy} (hf : DifferentiableAt 𝕜 f xy) : fderiv 𝕜 f xy = (fderiv 𝕜 (fun x' => f (x',xy.2)) xy.1).comp (ContinuousLinearMap.fst 𝕜 X Y) + (fderiv 𝕜 (fun y' => f (xy.1,y')) xy.2).comp (ContinuousLinearMap.snd 𝕜 X Y) := by apply ContinuousLinearMap.ext; intro (dx,dy) apply fderiv_uncurry ...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_wrt_prod
null
fderiv_wrt_prod_clm_comp (f : X × Y → Z) (hf : Differentiable 𝕜 f) : fderiv 𝕜 f = fun xy => (fderiv 𝕜 (fun x' => f (x',xy.2)) xy.1).comp (ContinuousLinearMap.fst 𝕜 X Y) + (fderiv 𝕜 (fun y' => f (xy.1,y')) xy.2).comp (ContinuousLinearMap.snd 𝕜 X Y) := fderiv_uncurry_clm_comp (fun x y => f (x,y)) hf
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_wrt_prod_clm_comp
null
fderiv_curry_clm_apply (f : X → Y →L[𝕜] Z) (y : Y) (x dx : X) (h : Differentiable 𝕜 f) : fderiv 𝕜 f x dx y = fderiv 𝕜 (f · y) x dx := by rw [fderiv_clm_apply] <;> first | simp | fun_prop /- Helper rw lemmas for proving differentiability conditions. -/
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_clm_apply
null
fderiv_uncurry_comp_fst (f : X → Y → Z) (y : Y) (hf : Differentiable 𝕜 (↿f)) : fderiv 𝕜 (fun x' => (↿f) (x', y)) = fun x => (fderiv 𝕜 (↿f) ((·, y) x)).comp (fderiv 𝕜 (·, y) x) := by have hl (y : Y) : (fun x' => (↿f) (x', y)) = ↿f ∘ (·, y) := by rfl rw [hl] funext x rw [fderiv_comp] · fun_prop · fun_prop
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_comp_fst
null
fderiv_uncurry_comp_snd (f : X → Y → Z) (x : X) (hf : Differentiable 𝕜 (↿f)) : fderiv 𝕜 (fun y' => (↿f) (x, y')) = fun y => (fderiv 𝕜 (↿f) ((x, ·) y)).comp (fderiv 𝕜 (x, ·) y) := by have hl (x : X) : (fun y' => (↿f) (x, y')) = ↿f ∘ (x, ·) := by rfl rw [hl] funext y rw [fderiv_comp] · fun_prop · fun_prop
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_comp_snd
null
fderiv_curry_comp_fst (f : X → Y → Z) (x dx : X) (y : Y) (hf : Differentiable 𝕜 (↿f)) : (fderiv 𝕜 (fun x' => f x' y) x) dx = (fderiv 𝕜 (↿f) ((·, y) x)) ((fderiv 𝕜 (·, y) x) dx) := by have hl (y : Y) : (fun x' => f x' y) = ↿f ∘ (·, y) := by rfl rw [hl] rw [fderiv_comp] simp only [ContinuousLinearMap.coe_comp', Funct...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_comp_fst
null
fderiv_curry_comp_snd (f : X → Y → Z) (x : X) (y dy : Y) (hf : Differentiable 𝕜 (↿f)) : (fderiv 𝕜 (fun y' => f x y') y) dy = (fderiv 𝕜 (↿f) ((x, ·) y)) ((fderiv 𝕜 (x, ·) y) dy) := by have hl (x : X) : (fun y' => f x y') = ↿f ∘ (x, ·) := by rfl rw [hl] rw [fderiv_comp] simp only [ContinuousLinearMap.coe_comp', Funct...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_comp_snd
null
fderiv_inr_fst_clm (x : X) (y : Y) : (fderiv 𝕜 (x, ·) y) = ContinuousLinearMap.inr 𝕜 X Y := by rw [(hasFDerivAt_prodMk_right x y).fderiv]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_inr_fst_clm
null
fderiv_inl_snd_clm (x : X) (y : Y) : (fderiv 𝕜 (·, y) x) = ContinuousLinearMap.inl 𝕜 X Y := by rw [(hasFDerivAt_prodMk_left x y).fderiv] /- Differentiability conditions. -/
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_inl_snd_clm
null
function_differentiableAt_fst (f : X → Y → Z) (x : X) (y : Y) (hf : Differentiable 𝕜 (↿f)) : DifferentiableAt 𝕜 (fun x' => f x' y) x := by have hl : (fun x' => f x' y) = ↿f ∘ (·, y) := by funext x' rfl rw [hl] apply Differentiable.differentiableAt apply Differentiable.comp · fun_prop · fun_prop
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
function_differentiableAt_fst
null
function_differentiableAt_snd (f : X → Y → Z) (x : X) (y : Y) (hf : Differentiable 𝕜 (↿f)) : DifferentiableAt 𝕜 (fun y' => f x y') y := by have hl : (fun y' => f x y') = ↿f ∘ (x, ·) := by funext y' rfl rw [hl] apply Differentiable.differentiableAt apply Differentiable.comp · fun_prop · fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
function_differentiableAt_snd
null
fderiv_uncurry_differentiable_fst (f : X → Y → Z) (y : Y) (hf : ContDiff 𝕜 2 ↿f) : Differentiable 𝕜 (fderiv 𝕜 fun x' => (↿f) (x', y)) := by fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_differentiable_fst
null
fderiv_uncurry_differentiable_snd (f : X → Y → Z) (x : X) (hf : ContDiff 𝕜 2 ↿f) : Differentiable 𝕜 (fderiv 𝕜 fun y' => (↿f) (x, y')) := by fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_differentiable_snd
null
fderiv_uncurry_differentiable_fst_comp_snd (f : X → Y → Z) (x : X) (hf : ContDiff 𝕜 2 ↿f) : Differentiable 𝕜 (fun y' => fderiv 𝕜 (fun x' => (↿f) (x', y')) x) := by fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_differentiable_fst_comp_snd
null
fderiv_uncurry_differentiable_fst_comp_snd_apply (f : X → Y → Z) (x δx : X) (hf : ContDiff 𝕜 2 ↿f) : Differentiable 𝕜 (fun y' => fderiv 𝕜 (fun x' => (↿f) (x', y')) x δx) := by fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_differentiable_fst_comp_snd_apply
null
fderiv_uncurry_differentiable_snd_comp_fst (f : X → Y → Z) (y : Y) (hf : ContDiff 𝕜 2 ↿f) : Differentiable 𝕜 (fun x' => fderiv 𝕜 (fun y' => (↿f) (x', y')) y) := by fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_differentiable_snd_comp_fst
null
fderiv_uncurry_differentiable_snd_comp_fst_apply (f : X → Y → Z) (y δy : Y) (hf : ContDiff 𝕜 2 ↿f) : Differentiable 𝕜 (fun x' => fderiv 𝕜 (fun y' => (↿f) (x', y')) y δy) := by fun_prop @[fun_prop]
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_uncurry_differentiable_snd_comp_fst_apply
null
fderiv_curry_differentiableAt_fst_comp_snd (f : X → Y → Z) (x dx : X) (y : Y) (hf : ContDiff 𝕜 2 ↿f) : DifferentiableAt 𝕜 (fun y' => (fderiv 𝕜 (fun x' => f x' y') x) dx) y := by apply Differentiable.differentiableAt fun_prop
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_differentiableAt_fst_comp_snd
null
fderiv_curry_differentiableAt_snd_comp_fst (f : X → Y → Z) (x : X) (y dy : Y) (hf : ContDiff 𝕜 2 ↿f) : DifferentiableAt 𝕜 (fun x' => (fderiv 𝕜 (fun y' => f x' y') y) dy) x := by apply Differentiable.differentiableAt fun_prop /- fderiv commutes on X × Y. -/
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_curry_differentiableAt_snd_comp_fst
null
fderiv_swap [IsRCLikeNormedField 𝕜] (f : X → Y → Z) (x dx : X) (y dy : Y) (hf : ContDiff 𝕜 2 ↿f) : fderiv 𝕜 (fun x' => fderiv 𝕜 (fun y' => f x' y') y dy) x dx = fderiv 𝕜 (fun y' => fderiv 𝕜 (fun x' => f x' y') x dx) y dy := by have hf' : IsSymmSndFDerivAt 𝕜 (↿f) (x,y) := by apply ContDiffAt.isSymmSndFDerivAt (n ...
lemma
PhysLean
[ "import Mathlib.Analysis.Calculus.FDeriv.Symmetric" ]
PhysLean/Mathematics/FDerivCurry.lean
fderiv_swap
null
predAboveI (i x : Fin n.succ.succ) : Fin n.succ := if h : x.val < i.val then ⟨x.val, by omega⟩ else ⟨x.val - 1, by by_cases hx : x = 0 · omega · omega⟩
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
predAboveI
/-- Given a `i` and `x` in `Fin n.succ.succ` returns an element of `Fin n.succ` subtracting 1 if `i.val ≤ x.val` else casting x. -/
predAboveI_self (i : Fin n.succ.succ) : predAboveI i i = ⟨i.val - 1, by omega⟩ := by simp [predAboveI] @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
predAboveI_self
/-- Given a `i` and `x` in `Fin n.succ.succ` returns an element of `Fin n.succ` subtracting 1 if `i.val ≤ x.val` else casting x. -/
predAboveI_succAbove (i : Fin n.succ.succ) (x : Fin n.succ) : predAboveI i (Fin.succAbove i x) = x := by simp only [Nat.succ_eq_add_one, predAboveI, Fin.succAbove, Fin.val_fin_lt, Fin.ext_iff] split_ifs · rfl · rename_i h1 h2 simp only [Fin.lt_def, Fin.coe_castSucc, not_lt, Fin.val_succ] at h1 h2 omega · rfl
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
predAboveI_succAbove
/-- Given a `i` and `x` in `Fin n.succ.succ` returns an element of `Fin n.succ` subtracting 1 if `i.val ≤ x.val` else casting x. -/
succsAbove_predAboveI {i x : Fin n.succ.succ} (h : i ≠ x) : Fin.succAbove i (predAboveI i x) = x := by simp only [Fin.succAbove, predAboveI, Nat.succ_eq_add_one, Fin.val_fin_lt, Fin.ext_iff] split_ifs · rfl · rename_i h1 h2 rw [Fin.lt_def] at h1 h2 simp only [Fin.succ_mk, add_eq_left, one_ne_zero] simp only [Fin.castSu...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
succsAbove_predAboveI
null
predAboveI_eq_iff {i x : Fin n.succ.succ} (h : i ≠ x) (y : Fin n.succ) : y = predAboveI i x ↔ i.succAbove y = x := by apply Iff.intro <;> intro h · subst h rw [succsAbove_predAboveI h] · simp [← h]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
predAboveI_eq_iff
null
predAboveI_lt {i x : Fin n.succ.succ} (h : x.val < i.val) : predAboveI i x = ⟨x.val, by omega⟩ := by simp [predAboveI, h]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
predAboveI_lt
null
predAboveI_ge {i x : Fin n.succ.succ} (h : i.val < x.val) : predAboveI i x = ⟨x.val - 1, by omega⟩ := by simp only [Nat.succ_eq_add_one, predAboveI, Fin.val_fin_lt, dite_eq_right_iff, Fin.mk.injEq] omega
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
predAboveI_ge
null
succAbove_succAbove_predAboveI (i : Fin n.succ.succ) (j : Fin n.succ) (x : Fin n) : i.succAbove (j.succAbove x) = (i.succAbove j).succAbove ((predAboveI (i.succAbove j) i).succAbove x) := by by_cases h1 : j.castSucc < i · have hx := Fin.succAbove_of_castSucc_lt _ _ h1 rw [hx, predAboveI_ge h1] by_cases hx1 : x.castSucc...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
succAbove_succAbove_predAboveI
null
finExtractOne {n : ℕ} (i : Fin (n + 1)) : Fin (n + 1) ≃ Fin 1 ⊕ Fin n := (finCongr (by omega : n.succ = i + 1 + (n - i))).trans <| finSumFinEquiv.symm.trans <| (Equiv.sumCongr (finSumFinEquiv.symm.trans (Equiv.sumComm (Fin i) (Fin 1))) (Equiv.refl (Fin (n-i)))).trans <| (Equiv.sumAssoc (Fin 1) (Fin i) (Fin (n - i))).tr...
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOne
/-- The equivalence between `Fin n.succ` and `Fin 1 ⊕ Fin n` extracting the `i`th component. -/
finExtractOne_apply_eq {n : ℕ} (i : Fin n.succ) : finExtractOne i i = Sum.inl 0 := by simp only [Nat.succ_eq_add_one, finExtractOne, Equiv.trans_apply, finCongr_apply, Equiv.sumCongr_apply, Equiv.coe_trans, Equiv.sumComm_apply, Equiv.coe_refl, Fin.isValue] rw [show Fin.cast _ i = Fin.castAdd ((n - ↑i)) ⟨i.1, lt_add_one...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOne_apply_eq
null
finExtractOne_symm_inr {n : ℕ} (i : Fin n.succ) : (finExtractOne i).symm ∘ Sum.inr = i.succAbove := by ext x simp only [Nat.succ_eq_add_one, finExtractOne, Function.comp_apply, Equiv.symm_trans_apply, finCongr_symm, Equiv.symm_symm, Equiv.sumCongr_symm, Equiv.refl_symm, Equiv.sumCongr_apply, Equiv.coe_refl, Sum.map_inr...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOne_symm_inr
null
finExtractOne_symm_inr_apply {n : ℕ} (i : Fin n.succ) (x : Fin n) : (finExtractOne i).symm (Sum.inr x) = i.succAbove x := calc _ = ((finExtractOne i).symm ∘ Sum.inr) x := rfl _ = i.succAbove x := by rw [finExtractOne_symm_inr] @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOne_symm_inr_apply
null
finExtractOne_symm_inl_apply {n : ℕ} (i : Fin n.succ) : (finExtractOne i).symm (Sum.inl 0) = i := by rfl
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOne_symm_inl_apply
null
finExtractOne_apply_neq {n : ℕ} (i j : Fin (n + 1 + 1)) (hij : i ≠ j) : finExtractOne i j = Sum.inr (predAboveI i j) := by symm apply (Equiv.symm_apply_eq _).mp ?_ simp only [Nat.succ_eq_add_one, finExtractOne_symm_inr_apply] exact succsAbove_predAboveI hij /-- Given an equivalence `Fin n.succ.succ ≃ Fin n.succ.succ`, ...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOne_apply_neq
null
finExtractOnPermHom {m : ℕ} (i : Fin n.succ.succ) (σ : Fin n.succ.succ ≃ Fin m.succ.succ) : Fin n.succ → Fin m.succ := fun x => predAboveI (σ i) (σ ((finExtractOne i).symm (Sum.inr x)))
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOnPermHom
/-- Given an equivalence `Fin n.succ.succ ≃ Fin n.succ.succ`, and an `i : Fin n.succ.succ`, the map `Fin n.succ → Fin n.succ` obtained by dropping `i` and it's image. -/
finExtractOnPermHom_inv {m : ℕ} (i : Fin n.succ.succ) (σ : Fin n.succ.succ ≃ Fin m.succ.succ) : (finExtractOnPermHom (σ i) σ.symm) ∘ (finExtractOnPermHom i σ) = id := by funext x simp only [Nat.succ_eq_add_one, Function.comp_apply, finExtractOnPermHom, Equiv.symm_apply_apply, finExtractOne_symm_inr_apply, id_eq] by_cas...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOnPermHom_inv
/-- Given an equivalence `Fin n.succ.succ ≃ Fin n.succ.succ`, and an `i : Fin n.succ.succ`, the map `Fin n.succ → Fin n.succ` obtained by dropping `i` and it's image. -/
finExtractOnePerm {m : ℕ} (i : Fin n.succ.succ) (σ : Fin n.succ.succ ≃ Fin m.succ.succ) : Fin n.succ ≃ Fin m.succ where toFun x := finExtractOnPermHom i σ x invFun x := finExtractOnPermHom (σ i) σ.symm x left_inv x := by simpa using congrFun (finExtractOnPermHom_inv i σ) x right_inv x := by simpa using congrFun (finExt...
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOnePerm
/-- Given an equivalence `Fin n.succ.succ ≃ Fin n.succ.succ`, and an `i : Fin n.succ.succ`, the equivalence `Fin n.succ ≃ Fin n.succ` obtained by dropping `i` and it's image. -/
finExtractOnePerm_equiv {n m : ℕ} (e : Fin n.succ.succ ≃ Fin m.succ.succ) (i : Fin n.succ.succ) : e ∘ i.succAbove = (e i).succAbove ∘ finExtractOnePerm i e := by simp only [Nat.succ_eq_add_one, finExtractOnePerm, Equiv.coe_fn_mk] funext x simp only [Function.comp_apply, finExtractOnPermHom, Nat.succ_eq_add_one, finExtr...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOnePerm_equiv
null
finExtractOnePerm_apply (i : Fin n.succ.succ) (σ : Fin n.succ.succ ≃ Fin n.succ.succ) (x : Fin n.succ) : finExtractOnePerm i σ x = predAboveI (σ i) (σ ((finExtractOne i).symm (Sum.inr x))) := rfl @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOnePerm_apply
null
finExtractOnePerm_symm_apply (i : Fin n.succ.succ) (σ : Fin n.succ.succ ≃ Fin n.succ.succ) (x : Fin n.succ) : (finExtractOnePerm i σ).symm x = predAboveI (σ.symm (σ i)) (σ.symm ((finExtractOne (σ i)).symm (Sum.inr x))) := rfl /-- The equivalence of types `Fin n.succ.succ ≃ (Fin 1 ⊕ Fin 1) ⊕ Fin n` extracting the `i` an...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractOnePerm_symm_apply
null
finExtractTwo {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : Fin n.succ.succ ≃ (Fin 1 ⊕ Fin 1) ⊕ Fin n := (finExtractOne i).trans <| (Equiv.sumCongr (Equiv.refl (Fin 1)) (finExtractOne j)).trans <| (Equiv.sumAssoc (Fin 1) (Fin 1) (Fin n)).symm @[simp]
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo
/-- The equivalence of types `Fin n.succ.succ ≃ (Fin 1 ⊕ Fin 1) ⊕ Fin n` extracting the `i` and `(i.succAbove j)`. -/
finExtractTwo_apply_fst {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : finExtractTwo i j i = Sum.inl (Sum.inl 0) := by simp [finExtractTwo]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo_apply_fst
/-- The equivalence of types `Fin n.succ.succ ≃ (Fin 1 ⊕ Fin 1) ⊕ Fin n` extracting the `i` and `(i.succAbove j)`. -/
finExtractTwo_symm_inr {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : (finExtractTwo i j).symm ∘ Sum.inr = i.succAbove ∘ j.succAbove := by rw [finExtractTwo] ext1 x simp @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo_symm_inr
null
finExtractTwo_symm_inr_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) (x : Fin n) : (finExtractTwo i j).symm (Sum.inr x) = i.succAbove (j.succAbove x) := by simp [finExtractTwo] @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo_symm_inr_apply
null
finExtractTwo_symm_inl_inr_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : (finExtractTwo i j).symm (Sum.inl (Sum.inr 0)) = i.succAbove j := by simp [finExtractTwo] @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo_symm_inl_inr_apply
null
finExtractTwo_symm_inl_inl_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : (finExtractTwo i j).symm (Sum.inl (Sum.inl 0)) = i := by rfl @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo_symm_inl_inl_apply
null
finExtractTwo_apply_snd {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : finExtractTwo i j (i.succAbove j) = Sum.inl (Sum.inr 0) := by simp [← Equiv.eq_symm_apply] /-- Takes two maps `Fin n → Fin n` and returns the equivalence they form. -/
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finExtractTwo_apply_snd
null
finMapToEquiv (f1 : Fin n → Fin m) (f2 : Fin m → Fin n) (h : ∀ x, f1 (f2 x) = x := by decide) (h' : ∀ x, f2 (f1 x) = x := by decide) : Fin n ≃ Fin m where toFun := f1 invFun := f2 left_inv := h' right_inv := h @[simp]
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finMapToEquiv
/-- Takes two maps `Fin n → Fin n` and returns the equivalence they form. -/
finMapToEquiv_apply {f1 : Fin n → Fin m} {f2 : Fin m → Fin n} {h : ∀ x, f1 (f2 x) = x} {h' : ∀ x, f2 (f1 x) = x} (x : Fin n) : finMapToEquiv f1 f2 h h' x = f1 x := rfl @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finMapToEquiv_apply
/-- Takes two maps `Fin n → Fin n` and returns the equivalence they form. -/
finMapToEquiv_symm_apply {f1 : Fin n → Fin m} {f2 : Fin m → Fin n} {h : ∀ x, f1 (f2 x) = x} {h' : ∀ x, f2 (f1 x) = x} (x : Fin m) : (finMapToEquiv f1 f2 h h').symm x = f2 x := rfl
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finMapToEquiv_symm_apply
null
finMapToEquiv_symm_eq {f1 : Fin n → Fin m} {f2 : Fin m → Fin n} {h : ∀ x, f1 (f2 x) = x} {h' : ∀ x, f2 (f1 x) = x} : (finMapToEquiv f1 f2 h h').symm = finMapToEquiv f2 f1 h' h := rfl /-- Given an equivalence between `Fin n` and `Fin m`, the induced equivalence between `Fin n.succ` and `Fin m.succ` derived by `Fin.cons`...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
finMapToEquiv_symm_eq
null
End of preview. Expand in Data Studio

Lean4-PhysLean

Structured dataset from PhysLean — Formalization of physics.

7,026 declarations extracted from Lean 4 source files.

Applications

  • Training language models on formal proofs
  • Fine-tuning theorem provers
  • Retrieval-augmented generation for proof assistants
  • Learning proof embeddings and representations

Source

Schema

Column Type Description
fact string Declaration body
type string theorem, def, lemma, etc.
library string Source module
imports list Required imports
filename string Source file path
symbolic_name string Identifier
docstring string Documentation (if present)
Downloads last month
6

Collection including phanerozoic/Lean4-PhysLean