ntp-mathlib / README.md
wellecks's picture
Update README.md
2ec5b5d verified
|
raw
history blame
4.01 kB
metadata
license: mit
tags:
  - theorem-proving
  - math
  - lean

Lean 4 tactic prediction examples extracted from Mathlib.

Citation

@misc{ntptutorial,
  author = {Sean Welleck},
  title = {Neural theorem proving tutorial},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/wellecks/ntptutorial}},
}

Version

Generated using ntptutorial's llm-training-data with the following config:

{
    "repo": "https://github.com/leanprover-community/mathlib4",
    "commit": "cf8e23a62939ed7cc530fbb68e83539730f32f86",
    "lean": "leanprover/lean4:v4.4.0",
    "name": "mathlib",
    "import_file": "Mathlib.lean",
    "imports": ["Mathlib"]
}

Example usage:

ds = datasets.load_dataset('wellecks/ntp-lean-mathlib-tactic')

print(len(ds['train']))
# ==> 337162

Example (ds['train'][0]):

{
  'state': 'R : Type u\nM : Type v\nF : Type u_1\nG : Type u_2\ninst✝² : CommSemiring R\ninst✝¹ : AddCommMonoid M\ninst✝ : Module R M\nI J : Ideal R\nN P : Submodule R M\ns : Set M\nr : R\n⊢ r ∈ annihilator (span R s) ↔ ∀ (n : ↑s), r • ↑n = 0',
  'srcUpToTactic': '/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.LinearAlgebra.Basis.Bilinear\nimport Mathlib.RingTheory.Coprime.Lemmas\nimport Mathlib.RingTheory.Ideal.Basic\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"\n\n/-!\n# More operations on modules and ideals\n-/\n\nuniverse u v w x\n\nopen BigOperators Pointwise\n\nnamespace Submodule\n\nvariable {R : Type u} {M : Type v} {F : Type*} {G : Type*}\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M]\n\nopen Pointwise\n\ninstance hasSMul\' : SMul (Ideal R) (Submodule R M) :=\n  ⟨Submodule.map₂ (LinearMap.lsmul R M)⟩\n#align submodule.has_smul\' Submodule.hasSMul\'\n\n/-- This duplicates the global `smul_eq_mul`, but doesn\'t have to unfold anywhere near as much to\napply. -/\nprotected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I • J = I * J :=\n  rfl\n#align ideal.smul_eq_mul Ideal.smul_eq_mul\n\n/-- `N.annihilator` is the ideal of all elements `r : R` such that `r • N = 0`. -/\ndef annihilator (N : Submodule R M) : Ideal R :=\n  LinearMap.ker (LinearMap.lsmul R N)\n#align submodule.annihilator Submodule.annihilator\n\nvariable {I J : Ideal R} {N P : Submodule R M}\n\ntheorem mem_annihilator {r} : r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = (0 : M) :=\n  ⟨fun hr n hn => congr_arg Subtype.val (LinearMap.ext_iff.1 (LinearMap.mem_ker.1 hr) ⟨n, hn⟩),\n    fun h => LinearMap.mem_ker.2 <| LinearMap.ext fun n => Subtype.eq <| h n.1 n.2⟩\n#align submodule.mem_annihilator Submodule.mem_annihilator\n\ntheorem mem_annihilator\' {r} : r ∈ N.annihilator ↔ N ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) ⊥ :=\n  mem_annihilator.trans ⟨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hn⟩\n#align submodule.mem_annihilator\' Submodule.mem_annihilator\'\n\ntheorem mem_annihilator_span (s : Set M) (r : R) :\n    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by\n  ',
  'nextTactic': 'rw [Submodule.mem_annihilator]',
  'declUpToTactic': 'theorem mem_annihilator_span (s : Set M) (r : R) :\n    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by\n  ',
  'declId': 'Examples.Mathlib.SplitRw.Mathlib_RingTheory_Ideal_Operations.60_0.HxKMH2Rj0L5BSy4',
  'decl': 'theorem mem_annihilator_span (s : Set M) (r : R) :\n    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 ',
  'file_tag': 'Mathlib_RingTheory_Ideal_Operations'
}