Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
7
403
proof
stringlengths
0
2.93k
type
stringclasses
5 values
symbolic_name
stringlengths
2
45
library
stringclasses
7 values
filename
stringclasses
24 values
imports
listlengths
1
10
deps
listlengths
0
5
docstring
stringclasses
10 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
simple_ex (n m : ℕ) (h1 : ∀ {a b : Nat}, a + b = b + a) (h2 : ∀ {a b : Nat}, a = b + b): n + m = m + n
by simp [h1, h2]
theorem
simple_ex
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
Prod (α : Type u) (β : Type v) | mk : α → β → Prod α β
inductive
OurInductives.Prod
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
Sum (α : Type u) (β : Type v) where | inl : α → Sum α β | inr : β → Sum α β
inductive
OurInductives.Sum
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
sum (hi: Sum Nat Nat) : True
by rcases hi with a | b sorry; sorry
theorem
OurInductives.sum
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
prod (hi: Prod Nat Nat) : True
by rcases hi with ⟨a, b⟩ sorry
theorem
OurInductives.prod
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
infoTree (hi: InfoTree) : True
by rcases hi sorry; sorry; sorry
theorem
OurInductives.infoTree
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
th11 : ∀ (N : ℕ), ∃ M, N + N = M
by { intro n exact ⟨ n + n, rfl ⟩ }
theorem
th11
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "intro" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
infinitude_of_primes : ∀ N, ∃ p, p ≥ N ∧ Nat.Prime p
by intro N let M := Nat.factorial N + 1 let p := Nat.minFac M have pp : Nat.Prime p := by apply Nat.minFac_prime have fac_pos: 0 < Nat.factorial N := by exact Nat.factorial_pos N omega have ppos: p ≥ N := by apply by_contradiction intro pln have h₁ : p ∣ Nat.factorial N := by ...
theorem
infinitude_of_primes
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply", "intro" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
irrational_sqrt_2 : ¬ ∃ (q : ℚ), q * q = 2
by apply not_exists.mpr intro ⟨n, d, _, coprime⟩ h have h₁ : n * n = 2 * d * d:= by rw [← Rat.normalize_self 2, Rat.mul_def, Rat.normalize_eq_iff] at h simp at h sorry -- linarith rw [← Int.natAbs_mul_self'] at h₁ have ⟨n', h₂⟩ : ∃ n', n.natAbs = 2 * n' := by have hm : Even (2 * d * d) := ...
theorem
irrational_sqrt_2
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply", "intro", "rw" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
mini_example : true = true
by have ⟨a, b⟩: ∃ c, c = 2 := by sorry have ⟨c, d⟩: ∃ e, e = 2 := ⟨2, rfl⟩ exact rfl
theorem
mini_example
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
test123 (p : Prop) (hp : p) : p ∧ p
by apply And.intro exact hp exact hp
theorem
test123
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
test (p q : Prop) (hp : p) (hq : q) : p ∧ q ∧ p
by apply And.intro exact hp apply And.intro exact hq exact hp
theorem
test
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
commutativityOfIntersections (s t : Set Nat) : s ∩ t = t ∩ s
by ext x apply Iff.intro intro h1 rw [Set.mem_inter_iff, and_comm] at h1 exact h1 intro h2 rw [Set.mem_inter_iff, and_comm] at h2 exact h2
theorem
commutativityOfIntersections
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply", "intro", "rw" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
simple : ∀ (N : ℕ), ∃ M, N + N = M
by intro n use n + n
theorem
simple
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "intro", "use" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
theorem_7 (p q r : Prop) : p ∧ (q ∨ r) ↔ (p ∧ q) ∨ (p ∧ r)
by apply Iff.intro intro xxx rcases xxx with ⟨hp, hqr⟩ rcases hqr with hq | hr left -- apply And.intro -- exact hp -- exact hq -- apply And.intro hp hq exact And.intro hp hq right exact And.intro hp hr intro wow apply And.intro rcases wow with hm | heh exact hm.left exact heh.left ...
theorem
theorem_7
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply", "intro" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
small_irrational : ¬ ∃ (q : ℚ), q * q = 2
by apply not_exists.mpr intro ⟨n, d, _, coprime⟩ h have ⟨n', h₂⟩ : ∃ n', n.natAbs = 2 * n' := by sorry have ⟨d', h₃⟩ : ∃ d', d = 2 * d' := by sorry have h₁ : n * n = 2 * d * d:= by sorry rw [← Int.natAbs_mul_self'] at h₁ rw [h₂, h₃] at h₁ have r : (∀ k, ¬ 2 * k = 1) := by sorry rw [Nat.coprime_iff_gcd...
theorem
small_irrational
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply", "intro", "rw" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
mem_split {a : α} {as : List α} (h : a ∈ as) : ∃ s t, as = s ++ a :: t
by induction as with | nil => cases h | cons b bs ih => cases h with | head bs => exact ⟨[], ⟨bs, rfl⟩⟩ | tail someVar h => match ih h with | ⟨s, ⟨t, h₂⟩⟩ => exact ⟨b :: s, ⟨t, h₂ ▸ rfl⟩⟩
theorem
mem_split
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "induction" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
mem {a : α} {as : List α} (h : a ∈ as) : ∃ s t, as = s ++ a :: t
by induction as with | nil => cases h | cons m mm => sorry
theorem
mem
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "induction" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
dojo4_uncombined (p q r : Prop) (hp : p) : (p ∨ q ∨ r) ∧ (q ∨ p ∨ r) ∧ (q ∨ r ∨ p)
by repeat (first | apply And.intro | apply Or.inl; assumption | apply Or.inr | assumption)
theorem
dojo4_uncombined
Root
Examples.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.GCongr", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
VERSION
4
def
Paperproof.VERSION
lean
lean/Paperproof.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.BetterParser", "Services.CheckIfUserIsStillTyping", "Services.GoalsAt", "Services.PrettifyRwTactic", "Services.ShouldRenderSingleSequent" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
Mode where | single_tactic | tree deriving FromJson, ToJson
inductive
Paperproof.Mode
lean
lean/Paperproof.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.BetterParser", "Services.CheckIfUserIsStillTyping", "Services.GoalsAt", "Services.PrettifyRwTactic", "Services.ShouldRenderSingleSequent" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
InputParams where pos : Lsp.Position mode: Mode deriving FromJson, ToJson
structure
Paperproof.InputParams
lean
lean/Paperproof.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.BetterParser", "Services.CheckIfUserIsStillTyping", "Services.GoalsAt", "Services.PrettifyRwTactic", "Services.ShouldRenderSingleSequent" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
OutputParams where steps : List Paperproof.Services.ProofStep version: Nat deriving Inhabited, FromJson, ToJson
structure
Paperproof.OutputParams
lean
lean/Paperproof.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.BetterParser", "Services.CheckIfUserIsStillTyping", "Services.GoalsAt", "Services.PrettifyRwTactic", "Services.ShouldRenderSingleSequent" ]
[ "Paperproof.Services.ProofStep" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getSnapshotData (params : InputParams) : RequestM (RequestTask OutputParams)
do withWaitFindSnapAtPos params.pos fun snap => do let fileMap : FileMap := (← readDoc).meta.text Paperproof.Services.checkIfUserIsStillTyping snap params.pos match params.mode with | .single_tactic => let hoverPos : String.Pos.Raw := fileMap.lspPosToUtf8Pos params.pos let some goalsAtResu...
def
Paperproof.getSnapshotData
lean
lean/Paperproof.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.BetterParser", "Services.CheckIfUserIsStillTyping", "Services.GoalsAt", "Services.PrettifyRwTactic", "Services.ShouldRenderSingleSequent" ]
[ "Paperproof.Services.ProofStep", "Paperproof.Services.checkIfUserIsStillTyping", "Paperproof.Services.goalsAt?", "Paperproof.Services.prettifyRwTactic", "Paperproof.Services.shouldRenderSingleSequent" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
Config where filePath : System.FilePath
"." constName : Lean.Name := `Unknown outputPath : System.FilePath := "."
structure
Config
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
parseArgs (args : Array String) : IO Config
do if args.size < 3 then throw <| IO.userError "usage: lake exe terminal FILE_PATH CONST_NAME OUTPUT_PATH" let cfg : Config := { filePath := ⟨args[0]!⟩, constName := args[1]!.toName, outputPath := ⟨args[2]!⟩ } IO.println s!"File: {cfg.filePath}" IO.println s!"Constant: {cfg.constName}" ...
def
parseArgs
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[ "Config" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
processCommands : Frontend.FrontendM (List (Lean.Environment × InfoState))
do let done ← Lean.Elab.Frontend.processCommand let st ← get let pair := (st.commandState.env, st.commandState.infoState) set { st with commandState := { st.commandState with infoState := {} } } if done then return [pair] else return pair :: (← processCommands)
def
processCommands
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
writeGoalInfo (goal : GoalInfo) : IO Unit
do IO.println s!" type: {goal.type}" if goal.hyps.isEmpty then IO.println s!" hyps: (none)" else IO.println s!" hyps:" for hyp in goal.hyps do IO.println s!" {hyp.username} : {hyp.type}"
def
writeGoalInfo
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
writeProofStep (step : ProofStep) (i : Nat) : IO Unit
do IO.println s!"[step {i}]" IO.println s!"tactic: {step.tacticString}" IO.println s!"goalBefore:" writeGoalInfo step.goalBefore if step.goalsAfter.isEmpty then IO.println s!"goalsAfter: (none)" else IO.println s!"goalsAfter:" for goal in step.goalsAfter do writeGoalInfo goal if step.spawnedGo...
def
writeProofStep
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[ "writeGoalInfo" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
printResult (r : Result) (outputPath : System.FilePath) : IO Unit
do if r.steps.isEmpty then IO.println "No proof steps found." return for (step, i) in r.steps.zipIdx do writeProofStep step (i + 1) IO.println "" IO.FS.writeFile outputPath (Json.pretty (toJson r)) IO.println s!"Saved to {outputPath}"
def
printResult
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[ "writeProofStep" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
main (args : List String) : IO Unit
do let config ← parseArgs args.toArray Lean.initSearchPath (← Lean.findSysroot) Lean.enableInitializersExecution let input ← IO.FS.readFile config.filePath let inputCtx := Lean.Parser.mkInputContext input config.filePath.toString let (header, parserState, messages) ← Lean.Parser.parseHeader inputCtx let (...
def
main
lean
lean/terminal.lean
[ "Lean", "Services.BetterParser" ]
[ "parseArgs", "printResult" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
formatGoalInfo (indent : String) (g : Paperproof.Services.GoalInfo) : String
let hyps := if g.hyps.isEmpty then s!"{indent} hyps: (none)" else s!"{indent} hyps:\n" ++ String.intercalate "\n" (g.hyps.map fun h => s!"{indent} {h.username} : {h.type}") s!"{indent} type: {g.type}\n{hyps}"
def
formatGoalInfo
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[ "Paperproof.Services.GoalInfo" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
formatGoalList (label : String) (goals : List Paperproof.Services.GoalInfo) : String
if goals.isEmpty then s!"{label}: (none)" else s!"{label}:\n" ++ String.intercalate "\n ============================\n" (goals.map (formatGoalInfo ""))
def
formatGoalList
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[ "Paperproof.Services.GoalInfo", "formatGoalInfo" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
formatDependsOn (ids : List String) (hyps : List Paperproof.Services.Hypothesis) : String
let names := ids.filterMap fun id => hyps.find? (·.id == id) |>.map (·.username) if names.isEmpty then "dependsOn: (none)" else s!"dependsOn: {String.intercalate ", " names}"
def
formatDependsOn
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[ "Paperproof.Services.Hypothesis" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
formatResult (r : Paperproof.Services.Result) : String
String.intercalate "\n\n" <| r.steps.zipIdx.map fun (step, i) => let goalBefore := s!"goalBefore:\n{formatGoalInfo "" step.goalBefore}" let goalsAfter := formatGoalList "goalsAfter" step.goalsAfter let spawned := formatGoalList "spawnedGoals" step.spawnedGoals let depOn := formatDependsOn step...
def
formatResult
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[ "Paperproof.Services.Result", "formatDependsOn", "formatGoalList", "spawned" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
elabAssertParser : CommandElab
| `(command| #assert_parser in $cmd) => do let fileMap ← getFileMap elabCommand cmd for tree in (← getInfoState).substituteLazy.get.trees do let some r ← liftTermElabM (liftM (Paperproof.Services.BetterParser_Tree fileMap tree)) | continue if !r.steps.isEmpty then logInfo (formatResult r) | _ ...
def
elabAssertParser
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[ "formatResult" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
simple (a b : ℕ) : a + b = b + a
by exact Nat.add_comm a b /-- info: [step 1] tactic: ext x goalBefore: type: s ∩ t = t ∩ s hyps: s : Set ℕ t : Set ℕ goalsAfter: type: x ∈ s ∩ t ↔ x ∈ t ∩ s hyps: s : Set ℕ t : Set ℕ x : ℕ spawnedGoals: (none) dependsOn: s, t [step 2] tactic: apply Iff.intro goalBefore: type: x ∈ s ∩ t...
theorem
simple
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
commutativityOfIntersections (s t : Set ℕ) : s ∩ t = t ∩ s
by ext x apply Iff.intro intro h1 rw [Set.mem_inter_iff, and_comm] at h1 exact h1 intro h2 rw [Set.mem_inter_iff, and_comm] at h2 exact h2 /-- info: [step 1] tactic: have easy: 4 = 2 + 2 := by rfl goalBefore: type: 666 = 665 + 1 hyps: (none) goalsAfter: type: 666 = 665 + 1 hyps: easy : 4 ...
theorem
commutativityOfIntersections
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[ "apply", "intro", "rw" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
spawned : 666 = 665 + 1
by have easy: 4 = 2 + 2 := by rfl simp
theorem
spawned
lean
lean/Tests.lean
[ "Lean", "Lean.Elab.Command", "Services.BetterParser", "Mathlib.Data.Set.Basic", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
Hypothesis where username : String type : String value : Option String -- unique identifier for the hypothesis, fvarId id : String isProof : String deriving Inhabited, ToJson, FromJson
structure
Paperproof.Services.Hypothesis
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
GoalInfo where username : String type : String hyps : List Hypothesis -- unique identifier for the goal, mvarId id : MVarId deriving Inhabited, ToJson, FromJson
structure
Paperproof.Services.GoalInfo
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
ProofStepPosition where start: Lsp.Position stop: Lsp.Position deriving Inhabited, ToJson, FromJson
structure
Paperproof.Services.ProofStepPosition
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
ProofStep where tacticString : String goalBefore : GoalInfo goalsAfter : List GoalInfo tacticDependsOn : List String spawnedGoals : List GoalInfo position : ProofStepPosition theorems : List TheoremSignature deriving Inhabited, ToJson, FromJson
structure
Paperproof.Services.ProofStep
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
stepGoalsAfter (step : ProofStep) : List GoalInfo
step.goalsAfter ++ step.spawnedGoals
def
Paperproof.Services.stepGoalsAfter
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
noInEdgeGoals (allGoals : Std.HashSet GoalInfo) (steps : List ProofStep) : Std.HashSet GoalInfo
-- Some of the orphaned goals might be matched by tactics in sibling subtrees, e.g. for tacticSeq. (steps.flatMap stepGoalsAfter).foldl Std.HashSet.erase allGoals
def
Paperproof.Services.noInEdgeGoals
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
findHypsUsedByTactic (goalId: MVarId) (goalDecl : MetavarDecl) (mctxAfter : MetavarContext) : MetaM (List String)
do let some expr := mctxAfter.eAssignment.find? goalId | return [] -- Need to instantiate it to get all fvars let fullExpr ← instantiateExprMVars expr let fvarIds := (collectFVars {} fullExpr).fvarIds let fvars := fvarIds.filterMap goalDecl.lctx.find? return fvars.map (fun x => x.fvarId.name.toString) ...
def
Paperproof.Services.findHypsUsedByTactic
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
findMVarsAssigned (goalId : MVarId) (mctxAfter : MetavarContext) : MetaM (List MVarId)
do let some expr := mctxAfter.eAssignment.find? goalId | return [] let (_, s) ← (Meta.collectMVars expr).run {} return s.result.toList
def
Paperproof.Services.findMVarsAssigned
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
mayBeProof (expr : Expr) : MetaM String
do let type : Expr ← Lean.Meta.inferType expr if ← Meta.isProof expr then return "proof" if type.isSort then return "universe" else return "data" public def printGoalInfo (printCtx : ContextInfo) (id : MVarId) : MetaM GoalInfo := do let some decl := printCtx.mctx.findDecl? id | throwError "go...
def
Paperproof.Services.mayBeProof
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getUnassignedGoals (goals : List MVarId) (mctx : MetavarContext) : MetaM (List MVarId)
do goals.filterMapM fun id => do if let none := mctx.findDecl? id then return none if mctx.eAssignment.contains id || mctx.dAssignment.contains id then return none return some id
def
Paperproof.Services.getUnassignedGoals
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
Result where steps : List ProofStep allGoals : Std.HashSet GoalInfo
structure
Paperproof.Services.Result
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getGoalsChange (ctx : ContextInfo) (tInfo : TacticInfo) : MetaM (List (List String × GoalInfo × List GoalInfo))
do -- We want to filter out `focus` like tactics which don't do any assignments -- therefore we check all goals on whether they were assigned during the tactic let goalMVars := tInfo.goalsBefore ++ tInfo.goalsAfter -- For printing purposes we always need to use the latest mctx assignments. For example in -- h...
def
Paperproof.Services.getGoalsChange
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
prettifySteps (stx : Syntax) (steps : List ProofStep) : List ProofStep
Id.run do match stx with | `(tactic| rw [$_,*] $(_)?) | `(tactic| rewrite [$_,*] $(_)?) => let prettify (tStr : String) := let res := (tStr.trimAscii.toString.dropEndWhile (· == ',')).toString -- rw puts final rfl on the "]" token if res == "]" then "rfl" else res return steps.map fun a ...
def
Paperproof.Services.prettifySteps
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
nameNumLt (n1 n2 : Name) : Bool
match n1, n2 with | .num _ n₁, .num _ n₂ => n₁ < n₂ | .num _ _, _ => true | _, _ => false
def
Paperproof.Services.nameNumLt
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
prettifyTacticString (tacticString: String) : String
((tacticString.splitOn "\n").head?.getD tacticString).trimAscii.toString
def
Paperproof.Services.prettifyTacticString
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
By default, `.getSubstring()` captures empty lines and comments after the tactic - this function removes them.
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getProofStepPosition (fileMap : FileMap) (tacticSubstring: Substring.Raw) : ProofStepPosition
{ start := Lean.FileMap.utf8PosToLspPos fileMap tacticSubstring.startPos, stop := Lean.FileMap.utf8PosToLspPos fileMap tacticSubstring.stopPos }
def
Paperproof.Services.getProofStepPosition
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
parseTacticBody (fileMap : FileMap) (ctx : ContextInfo) (tInfo : TacticInfo) (tacticSubstring : Substring.Raw) (steps : List ProofStep) (allGoals : Std.HashSet GoalInfo) (tacticString : String) (theorems : List TheoremSignature) : MetaM Result
do let steps := prettifySteps tInfo.stx steps let position := getProofStepPosition fileMap tacticSubstring let proofTreeEdges ← getGoalsChange ctx tInfo let currentGoals := proofTreeEdges.map (fun ⟨ _, g₁, gs ⟩ => g₁ :: gs) |>.flatten let allGoals := allGoals.insertMany $ currentGoals -- It's like tacticD...
def
Paperproof.Services.parseTacticBody
lean.Services
lean/Services/BetterParser.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Meta.CollectMVars", "Services.GetTheorems", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
checkIfUserIsStillTyping (snap : Snapshots.Snapshot) (hoverPos : Lsp.Position) : RequestM Unit
do -- old: snap.beginPos if let some beginPosition := snap.stx.getPos? then let doc ← readDoc let text := doc.meta.text let snapBegins := text.utf8PosToLspPos beginPosition -- We won't get error messages for this, -- but if we have the following arrangement, then there is some syntax error: ...
def
Paperproof.Services.checkIfUserIsStillTyping
lean.Services
lean/Services/CheckIfUserIsStillTyping.lean
[ "Lean" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getTacticSubstring (tInfo : TacticInfo) : Option Substring.Raw
match tInfo.stx.getSubstring? with | .some substring => substring | .none => none
def
Paperproof.Services.getTacticSubstring
lean.Services
lean/Services/GetTacticSubstring.lean
[ "Lean" ]
[]
InfoTree has a lot of non-user-written intermediate `TacticInfo`s, this function returns `none` for those. @EXAMPLES `tInfo.stx` //=> `(Tactic.tacticSeq1Indented [(Tactic.exact "exact" (Term.proj ab "." (fieldIdx "2")))])` `tInfo.stx.getSubstring?` //=> `(some (exact ab.2 ))` `tInfo.stx` ...
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
ArgumentInfo where name : String type : String deriving Inhabited, FromJson, ToJson
structure
Paperproof.Services.ArgumentInfo
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
DeclarationInfo where name : Name declarationType : String -- "theorem", "lemma", "definition", "axiom", etc. body : Option String -- definition body if applicable deriving Inhabited, FromJson, ToJson
structure
Paperproof.Services.DeclarationInfo
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
TheoremSignature where name : String instanceArgs : List ArgumentInfo
[] -- [] implicitArgs : List ArgumentInfo := [] -- {} explicitArgs : List ArgumentInfo := [] -- () type : String := "" -- return type declarationType : String := "" -- declaration type body : Option String := none -- definition body if applicable ...
structure
Paperproof.Services.TheoremSignature
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getIds : Syntax → NameSet
| .node _ _ args => (args.map getIds).foldl (·.append ·) {} | .ident _ _ nm _ => NameSet.empty.insert nm | _ => {}
def
Paperproof.Services.getIds
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getAllArgsWithTypes (expr : Expr) : MetaM (List ArgumentInfo × List ArgumentInfo × List ArgumentInfo × String)
do Meta.forallTelescope expr fun args body => do let mut lctx := LocalContext.empty for arg in args do let decl ← arg.fvarId!.getDecl lctx := lctx.addDecl decl let ppCtx : PPContext := { env := ← getEnv, mctx := ← getMCtx, lctx, opts := (← getOptions).setBool `...
def
Paperproof.Services.getAllArgsWithTypes
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
isInRange (substr : Substring.Raw) (startPos stopPos : String.Pos.Raw) : Bool
substr.startPos >= startPos && substr.stopPos <= stopPos
def
Paperproof.Services.isInRange
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
Check if a substring position is within a given range
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getDeclarationType (ci : ConstantInfo) : String
match ci with | .axiomInfo _ => "axiom" | .defnInfo _ => "def" | .thmInfo _ => "theorem" | .opaqueInfo _ => "opaque" | .quotInfo _ => "quotient" | .inductInfo _ => "inductive" | .ctorInfo _ => "constructor" | .recInfo _ => "recursor"
def
Paperproof.Services.getDeclarationType
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
Get declaration type string from ConstantInfo
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
processDeclaration (name : Name) (ctx : ContextInfo) (goalDecl : MetavarDecl) : MetaM (Option TheoremSignature)
do let constInfo ← getConstInfo name let declType := getDeclarationType constInfo -- Only process theorems, axioms, and definitions unless (declType == "theorem" || declType == "axiom" || declType == "def") do return none let ppCtx := { (ctx.toPPContext (goalDecl.lctx |>.sanitizeNames.run' {options ...
def
Paperproof.Services.processDeclaration
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
Process a declaration and extract all relevant info (type, args, body)
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
extractTheoremName (expr : Expr) (lctx : LocalContext) : Option Name
do guard (!expr.isSyntheticSorry) -- It's important to use cleanExpr here, otherwise we'll be getting "fvar expected" exceptions sometimes let cleanExpr := expr.consumeMData match cleanExpr with | .const name _ => some name | .app .. => expr.getAppFn.consumeMData.constName? | .fvar .. => do let ldecl ...
def
Paperproof.Services.extractTheoremName
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
Extract theorem name from expression, handling constants, applications, and local variables
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
findTheoremsLikeHover (tree : Elab.InfoTree) (tacticStartPos tacticStopPos : String.Pos.Raw) (ctx : ContextInfo) (goalDecl : MetavarDecl) : MetaM (List TheoremSignature)
do let mut theoremNames : NameSet := {} -- Sample positions throughout the tactic range (every few characters) -- This ensures we catch all identifiers that would show on hover let mut currentPos := tacticStartPos let step : Nat := 3 -- Check every 3 characters while currentPos < tacticStopPos do -- ...
def
Paperproof.Services.findTheoremsLikeHover
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
Extract theorem names exactly like Lean's hover does - using built-in hover functionality
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
GetTheorems (infoTree : InfoTree) (tacticInfo : TacticInfo) (ctx : ContextInfo) : MetaM (List TheoremSignature)
do let some goalMVar := tacticInfo.goalsBefore.head? | throwError "noGoals" let some goalDecl := ctx.mctx.findDecl? goalMVar | throwError "noGoalDecl" let some tacticSubstring := getTacticSubstring tacticInfo | throwError "noTacticSubstring" ctx.runMetaM goalDecl.lctx do findTheoremsLikeHover i...
def
Paperproof.Services.GetTheorems
lean.Services
lean/Services/GetTheorems.lean
[ "Lean", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
goalsAt? (t : InfoTree) (text : FileMap) (hoverPos : String.Pos.Raw) : List GoalsAtResult
let gs := t.collectNodesBottomUp fun ctx i cs gs => Id.run do if let Info.ofTacticInfo ti := i then if let (some pos, some tailPos) := (i.pos?, i.tailPos?) then let trailSize := i.stx.getTrailingSize -- dbg_trace trailSize -- show info at EOF even if strictly outside token + trail ...
def
Paperproof.Services.goalsAt?
lean.Services
lean/Services/GoalsAt.lean
[ "Lean" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
State | start | tacticStringWillOccurSoon | tacticStringStarted
inductive
Paperproof.Services.State
lean.Services
lean/Services/PrettifyRwTactic.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
getClosestRw (text: Lean.FileMap) (hoverPos: String.Pos.Raw) : Id String
do let mut currentPosition : String.Pos.Raw := hoverPos let text : String := Lean.FileMap.source text let mut state : State := State.start let mut rwList : List Char := [] while currentPosition != 0 do currentPosition := currentPosition.prev text let currentChar := currentPosition.get text m...
def
Paperproof.Services.getClosestRw
lean.Services
lean/Services/PrettifyRwTactic.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.GetTacticSubstring" ]
[]
EXAMPLE `rw_mod_cast [Set.mem_inter_iff, and_com|m]` //=> `"rw_mod_cast"` `nth_rw 2 [Na|t.add_comm]` //=> `"nth_rw"`
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
prettifyRwRule (tacticString : String)
((tacticString.splitOn ",").head?.getD tacticString).trimAscii.toString
def
Paperproof.Services.prettifyRwRule
lean.Services
lean/Services/PrettifyRwTactic.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.GetTacticSubstring" ]
[]
EXAMPLE `prettifyRwRule "Set.mem_inter_iff, "` //=> `"Set.mem_inter_iff"`
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
isTacticRwRule (tacticInfo: TacticInfo) : Bool
let string : String := tacticInfo.stx.formatStx.pretty string.startsWith "[(Tactic.rwRule"
def
Paperproof.Services.isTacticRwRule
lean.Services
lean/Services/PrettifyRwTactic.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
prettifyRwTactic (tacticInfo : TacticInfo) (text : FileMap) (hoverPos : String.Pos.Raw) : RequestM String
do if (isTacticRwRule tacticInfo) then let .some tacticSubstring := getTacticSubstring tacticInfo | return "" let closestRwTacticName := getClosestRw text hoverPos let tacticStr := Substring.Raw.toString tacticSubstring let rwRule := ((tacticStr.splitOn ",").head?.getD tacticStr).trimAscii.toStri...
def
Paperproof.Services.prettifyRwTactic
lean.Services
lean/Services/PrettifyRwTactic.lean
[ "Lean", "Lean.Meta.Basic", "Lean.Elab.Tactic", "Services.GetTacticSubstring" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
shouldRenderSingleSequent (tacticInfo : TacticInfo) (text : FileMap) (hoverPos : String.Pos.Raw) : RequestM Bool
do let .some tacticSubstring := tacticInfo.stx.getSubstring? | throwThe RequestError ⟨.invalidParams, "couldntFindTacticSubstring"⟩ let file : String := Lean.FileMap.source text let charBefore := hoverPos.prev file |>.get file let charAfter := hoverPos.get file let atEOF := hoverPos.atEnd file let is...
def
Paperproof.Services.shouldRenderSingleSequent
lean.Services
lean/Services/ShouldRenderSingleSequent.lean
[ "Lean" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
apply (a b : ℝ) : a = b
by apply le_antisymm
theorem
apply
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
have_ (a b : ℝ) (h1 : a ≤ b) (h2 : b ≤ a) : True
by have hi := le_antisymm h1 h2
theorem
have_
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
intro : ∀ (N : ℕ), ∃ M, N + N = M
by intro n
theorem
intro
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
rw (a b : ℕ) (h1: a = b) : (10 * a = 666)
by rw [h1]
theorem
rw
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
by_contra_ (m : ℕ) : 2 ≤ m
by by_contra h
theorem
by_contra_
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
use : ∃ x : Nat, x = 5
by use 42
theorem
use
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
induction (n : ℕ) : Nat.mul 0 n = 0
by induction n
theorem
induction
_examples.demos
_examples/demos/CommonTactics.lean
[ "Mathlib.Algebra.GCDMonoid.Multiset", "Mathlib.Data.Real.Basic", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
"myPersonalTactic" : tactic => do let mvarId ← Lean.Elab.Tactic.getMainGoal let term ← `(λ a b ab => And.casesOn (motive := λ t => ab = t → b ∧ a) ab (λ hA hB _ => And.intro hB hA) (Eq.refl ab)) let expr ← Lean.Elab.Tactic.elabTerm term none mvarId.assign expr
elab
myPersonalTactic
_examples.demos
_examples/demos/Explode.lean
[ "Mathlib.Tactic.Cases", "Mathlib.Tactic.Explode", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
tacticProof (a b : Prop) : a ∧ b → b ∧ a
by intro ab rcases ab with ⟨hA, hB⟩ apply And.intro exact hB exact hA
theorem
tacticProof
_examples.demos
_examples/demos/Explode.lean
[ "Mathlib.Tactic.Cases", "Mathlib.Tactic.Explode", "Paperproof" ]
[ "apply", "intro" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
prooftermProof (a b : Prop) : a ∧ b → b ∧ a
λ ab => And.casesOn (motive := λ t => ab = t → b ∧ a) ab (λ hA hB _ => And.intro hB hA) (Eq.refl ab)
theorem
prooftermProof
_examples.demos
_examples/demos/Explode.lean
[ "Mathlib.Tactic.Cases", "Mathlib.Tactic.Explode", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
sweepingTacticProof : ∀ (a b : Prop), a ∧ b → b ∧ a
by myPersonalTactic -- #explode results in exactly the same output, because it's based on `Expr`s. -- Contrast this with Paperproof outputs, which are based on `InfoTree`s. #explode tacticProof #explode prooftermProof #explode sweepingTacticProof
theorem
sweepingTacticProof
_examples.demos
_examples/demos/Explode.lean
[ "Mathlib.Tactic.Cases", "Mathlib.Tactic.Explode", "Paperproof" ]
[ "prooftermProof", "tacticProof" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
"tactic_1" : tactic => do let mvarId ← getMainGoal let goalType ← getMainTarget let Expr.app (Expr.app (Expr.const `Iff _) a) b
goalType | throwError "Goal type is not of the form `a ↔ b`" -- 1. Create new `_`s with appropriate types. let mvarId1 ← mkFreshExprMVar (Expr.forallE `xxx a b .default) (userName := Lean.Name.mkSimple "red") let mvarId2 ← mkFreshExprMVar (Expr.forallE `yyy b a .default) (userName := Lean.Name.mkSimple "blue") ...
elab
tactic_1
_examples.demos
_examples/demos/GoalsFormATree.lean
[ "Lean.Elab.Tactic", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
"tactic_2" : tactic => do let some redMvarId ← (← get).goals.findM? (fun mvarId => do return (← mvarId.getDecl).userName == `red ) | throwError "No mvar with username `red`" let some blueMvarId ← (← get).goals.findM? (fun mvarId => do return (← mvarId.getDecl).userName == `blue ) | throwError "No mvar w...
(← redMvarId.getDecl).type | throwError "Goal type is not of the form `a → b`" let handyRedMvarId ← withLocalDecl `hA BinderInfo.default redFrom (fun fvar => do -- 1. Create new `_`s with appropriate types. let mvarId1 ← mkFreshExprMVar redTo MetavarKind.syntheticOpaque `red -- 2. Assign the main goal to ...
elab
tactic_2
_examples.demos
_examples/demos/GoalsFormATree.lean
[ "Lean.Elab.Tactic", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
gradual (p q : Prop) : p ∧ q ↔ q ∧ p
by tactic_1 tactic_2 sorry
theorem
gradual
_examples.demos
_examples/demos/GoalsFormATree.lean
[ "Lean.Elab.Tactic", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
andIntroductionTop {A B : Prop} (h1 : A) (h2 : B) : OurGoal
by have h := And.intro h1 h2 all_goals sorry
theorem
andIntroductionTop
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
andIntroductionBottom {A B : Prop} (h1 : A) (h2 : B) : A ∧ B
by apply And.intro all_goals sorry
theorem
andIntroductionBottom
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
andEliminationTop {A B : Prop} (h : A ∧ B) : OurGoal
by -- have h1 := h.left apply And.left at h sorry
theorem
andEliminationTop
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
andEliminationBottom {A B : Prop} : A
by apply And.left (a := A) (b := B) sorry
theorem
andEliminationBottom
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
orIntroductionTop {A B : Prop} (h : A) : OurGoal
by have ab : A ∨ B := Or.inl h sorry
theorem
orIntroductionTop
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
orIntroductionBottom {A B : Prop} : A ∨ B
by apply Or.inl sorry
theorem
orIntroductionBottom
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
orEliminationTop {A B : Prop} (h : A ∨ B) : OurGoal
by cases' h with a b all_goals sorry
theorem
orEliminationTop
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
orEliminationBottom {A B : Prop} : OurGoal
by apply Or.elim (a := A) (b := B) all_goals sorry
theorem
orEliminationBottom
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[ "apply" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
arrowIntroductionTop {A B : Prop} (b : B) : OurGoal
by let h := λ a : A => b sorry
theorem
arrowIntroductionTop
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
arrowIntroductionBottom {A B : Prop} : A → B
by intro a sorry
theorem
arrowIntroductionBottom
_examples.demos
_examples/demos/NaturalDeduction.lean
[ "Mathlib.Data.Nat.Prime.Basic", "Mathlib.Data.List.Chain", "Mathlib.Tactic.Linarith", "Mathlib.Data.Set.Basic", "Mathlib.Data.Finset.Fold", "Mathlib.Algebra.GCDMonoid.Multiset", "Lean", "Paperproof" ]
[ "intro" ]
https://github.com/Paper-Proof/paperproof
c944afd12974e745b26f803acf67af02e7820271
End of preview. Expand in Data Studio

Lean4-Paperproof

Structured dataset from Paperproof — Visual proof assistant.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 150
  • With proof: 135 (90.0%)
  • With docstring: 9 (6.0%)
  • Libraries: 7

By type

Type Count
theorem 90
def 41
structure 11
inductive 5
elab 3

Example

simple_ex (n m : ℕ)
  (h1 : ∀ {a b : Nat}, a + b = b + a)
  (h2 : ∀ {a b : Nat}, a = b + b):
    n + m = m + n
by
  simp [h1, h2]
  • type: theorem | symbolic_name: simple_ex | Examples.lean

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{lean4_paperproof_dataset,
  title  = {Lean4-Paperproof},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/Paper-Proof/paperproof, commit c944afd12974},
  url    = {https://huggingface.co/datasets/phanerozoic/Lean4-Paperproof}
}
Downloads last month
66

Collection including phanerozoic/Lean4-Paperproof