-
Notifications
You must be signed in to change notification settings - Fork 16
fix: print-paths
changed to setup-file
in Lean v4.4.0
#55
Conversation
Locally it works fine (on Mac and my Ubuntu CI), but CI is red. Will look into that later. |
f056779
to
c65e5f2
Compare
There is no way I can pass the test for LeanInk. I tried the 2 approaches:
|
I'll take approach 1, and fix the tests later. In the meanwhile, code in this PR or branch fix-print-path-nobump can |
@@ -980,7 +980,7 @@ | |||
"The `simp` tactic uses lemmas and hypotheses to simplify the main goal target or\nnon-dependent hypotheses. It has many variants:\n- `simp` simplifies the main goal target using lemmas tagged with the attribute `[simp]`.\n- `simp [h₁, h₂, ..., hₙ]` simplifies the main goal target using the lemmas tagged\n with the attribute `[simp]` and the given `hᵢ`'s, where the `hᵢ`'s are expressions.\n If an `hᵢ` is a defined constant `f`, then the equational lemmas associated with\n `f` are used. This provides a convenient way to unfold `f`.\n- `simp [*]` simplifies the main goal target using the lemmas tagged with the\n attribute `[simp]` and all hypotheses.\n- `simp only [h₁, h₂, ..., hₙ]` is like `simp [h₁, h₂, ..., hₙ]` but does not use `[simp]` lemmas.\n- `simp [-id₁, ..., -idₙ]` simplifies the main goal target using the lemmas tagged\n with the attribute `[simp]`, but removes the ones named `idᵢ`.\n- `simp at h₁ h₂ ... hₙ` simplifies the hypotheses `h₁ : T₁` ... `hₙ : Tₙ`. If\n the target or another hypothesis depends on `hᵢ`, a new simplified hypothesis\n `hᵢ` is introduced, but the old one remains in the local context.\n- `simp at *` simplifies all the hypotheses and the target.\n- `simp [*] at *` simplifies target and all (propositional) hypotheses using the\n other hypotheses.\n", | |||
"_type": "token"}, | |||
{"typeinfo": | |||
{"type": "{α : Type ?u.3247} → [self : BEq α] → α → α → Bool", | |||
{"type": "{α : Type ?u.3298} → [self : BEq α] → α → α → Bool", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De Bruijn index change across versions seems to be normal.
@@ -1939,7 +1939,7 @@ | |||
"raw": "absurd", | |||
"link": null, | |||
"docstring": | |||
"Anything follows from two contradictory hypotheses. Example:\n```\nexample (hp : p) (hnp : ¬p) : q := absurd hp hnp\n```\nFor more information: [Propositional Logic](https://leanprover.github.io/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)\n", | |||
"Anything follows from two contradictory hypotheses. Example:\n```\nexample (hp : p) (hnp : ¬p) : q := absurd hp hnp\n```\nFor more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is full of this url change. Here is the meaningful diff produced by
git diff 71b8365e08fb8b786cff628bbea38a2512370ca7 0227adbf7ee9b323efa0c47bbd00c8976b51e4a1 test/bench/Basic.lean.leanInk.expected|grep -E '^[-+] '|grep -v theorem_proving_in_lean4
- {"type": "{α : Type ?u.3247} → [self : BEq α] → α → α → Bool",
+ {"type": "{α : Type ?u.3298} → [self : BEq α] → α → α → Bool",
- {"typeinfo": {"type": "m + n = k + m", "name": "h", "_type": "typeinfo"},
+ {"typeinfo": {"type": "n + m = k + m", "name": "h", "_type": "typeinfo"},
- "conclusion": "0 = 0 + zero * k",
+ "conclusion": "0 = zero * m + zero * k",
- [{"name": "",
- "hypotheses": [],
- "conclusion": "Goals accomplished! 🐙",
+ [{"name": "zero",
+ "hypotheses":
+ [{"type": "Nat", "names": ["m", "k"], "body": "", "_type": "hypothesis"}],
+ "conclusion": "0 = 0 + zero * k",
- [{"name": "zero",
- "hypotheses":
- [{"type": "Nat", "names": ["m", "k"], "body": "", "_type": "hypothesis"}],
- "conclusion": "0 = zero * m + zero * k",
+ [{"name": "",
+ "hypotheses": [],
+ "conclusion": "Goals accomplished! 🐙",
- {"typeinfo": {"type": "n * m = k * m", "name": "h", "_type": "typeinfo"},
+ {"typeinfo": {"type": "m * n = k * m", "name": "h", "_type": "typeinfo"},
- "raw": " => ",
+ "raw": " ",
- {"messages": [],
+ {"messages":
+ [{"contents":
+ "Error: unsolved goals\ncase succ\nn : Nat\nih : 0 - n = 0\n⊢ pred 0 = 0",
+ "_type": "message"}],
- [{"name": "",
- "hypotheses": [],
- "conclusion": "Goals accomplished! 🐙",
+ [{"name": "succ",
+ "hypotheses":
+ [{"type": "Nat", "names": ["n"], "body": "", "_type": "hypothesis"},
+ {"type": "0 - n = 0", "names": ["ih"], "body": "", "_type": "hypothesis"}],
+ "conclusion": "0 - succ n = 0",
+ "_type": "goal"}],
+ "contents":
+ [{"typeinfo": null,
+ "semanticType": null,
+ "raw": "=> ",
+ "link": null,
+ "docstring":
+ "In induction alternative, which can have 1 or more cases on the left\nand `_`, `?_`, or a tactic sequence after the `=>`.\n",
+ "_type": "token"}],
+ "_type": "sentence"},
+ {"messages":
+ [{"contents":
+ "Error: unsolved goals\ncase succ\nn : Nat\nih : 0 - n = 0\n⊢ pred 0 = 0",
+ "_type": "message"}],
+ "goals":
+ [{"name": "succ",
+ "hypotheses":
+ [{"type": "Nat", "names": ["n"], "body": "", "_type": "hypothesis"},
+ {"type": "0 - n = 0", "names": ["ih"], "body": "", "_type": "hypothesis"}],
+ "conclusion": "pred 0 = 0",
@@ -40,7 +40,7 @@ | |||
"raw": "Unit", | |||
"link": null, | |||
"docstring": | |||
"The unit type, the canonical type with one element, named `unit` or `()`.\nIn other words, it describes only a single value, which consists of said constructor applied\nto no arguments whatsoever.\nThe `Unit` type is similar to `void` in languages derived from C.\n\n`Unit` is actually defined as `PUnit.{0}` where `PUnit` is the universe\npolymorphic version. The `Unit` should be preferred over `PUnit` where possible to avoid\nunnecessary universe parameters.\n\nIn functional programming, `Unit` is the return type of things that \"return\nnothing\", since a type with one element conveys no additional information.\nWhen programming with monads, the type `m Unit` represents an action that has\nsome side effects but does not return a value, while `m α` would be an action\nthat has side effects and returns a value of type `α`.\n", | |||
"The unit type, the canonical type with one element, named `unit` or `()`.\nIn other words, it describes only a single value, which consists of said constructor applied\nto no arguments whatsoever.\nThe `Unit` type is similar to `void` in languages derived from C.\n\n`Unit` is actually defined as `PUnit.{1}` where `PUnit` is the universe\npolymorphic version. The `Unit` should be preferred over `PUnit` where possible to avoid\nunnecessary universe parameters.\n\nIn functional programming, `Unit` is the return type of things that \"return\nnothing\", since a type with one element conveys no additional information.\nWhen programming with monads, the type `m Unit` represents an action that has\nsome side effects but does not return a value, while `m α` would be an action\nthat has side effects and returns a value of type `α`.\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PUnit.{0}
changed to PUnit.{1}
.
@@ -103,7 +103,7 @@ | |||
"link": null, | |||
"docstring": null, | |||
"_type": "token"}, | |||
{"typeinfo": {"type": "A × A → B", "name": "B", "_type": "typeinfo"}, | |||
{"typeinfo": {"type": "Type", "name": "B", "_type": "typeinfo"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why this is A × A → B
before. B
is
structure B where
pair : A × A
Obviously B is just a Type.
{"messages": | ||
[{"contents": | ||
"Error: unsolved goals\ncase succ\nn : Nat\nih : 0 - n = 0\n⊢ pred 0 = 0", | ||
"_type": "message"}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This proof is no longer proven, will investigate. The same applies to all Error: unsolved goals
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@[simp] protected theorem zero_sub (n : Nat) : 0 - n = 0 := by
induction n with
| zero => rfl
| succ n ih => simp [ih, Nat.sub_succ]
This proof failed to use the protected simp lemma pred_zero
in the same namespace, is this expected?
@@ -51,11 +56,13 @@ def initializeLakeContext (lakeFile : FilePath) (header : Syntax) : AnalysisM Un | |||
| 0 => do | |||
let stdout := stdout.split (· == '\n') |>.getLast! | |||
match Json.parse stdout with | |||
| Except.error _ => throw <| IO.userError s!"Failed to parse lake output: {stdout}" | |||
| Except.error msg => throw <| IO.userError s!"Failed to parse lake output: {stdout}\nerror: {msg}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The msg
is helpful for debugging.
Note that this branch (and its fixes) also fixes my issue #56. |
Description
LeanInk/Analysis/LeanContext.lean
relies onprint-paths
toinitializeLakeContext
, but in leanprover/lean4#2858 which is part of Lean v4.4.0 release,print-paths
is changed tosetup-file
, with an extra parameter and changed JSON output.This PR bumps LeanInk to use v4.4.0-rc1, replacing
print-paths
withsetup-file
and handles the parameter and output change accordingly.There is probably no immediate need to merge this PR as doc-gen4 is using https://github.com/hargoniX/LeanInk/ which is 30+ commits behind
leanprover/LeanInk
and doesn't have this file, and I'm not aware of other major users.More discussions on Zulip.
Notable Changes
Additional Notes