Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: well-founded function definition preprocessing #296

Merged
merged 19 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vale/styles/config/ignore/terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,4 @@ unparenthesized
uploader
upvote
walkthrough
preprocesses
3 changes: 3 additions & 0 deletions Manual/BasicTypes.lean
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ end ShortCircuit
{include 0 Manual.BasicTypes.Array}

# Subtypes
%%%
tag := "Subtype"
%%%

:::planned 173
* When to use them?
Expand Down
11 changes: 9 additions & 2 deletions Manual/Meta/Lean.lean
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ def signature : CodeBlockExpander
| args, str => do
let {«show»} ← SignatureConfig.parse.run args
let altStr ← parserInputString str
let col? := (← getRef).getPos? |>.map (← getFileMap).utf8PosToLspPos |>.map (·.character)


match Parser.runParserCategory (← getEnv) `signature_spec altStr (← getFileName) with
| .error e => throwError e
Expand All @@ -602,14 +604,19 @@ def signature : CodeBlockExpander
try
let ((hls, _, _, _), st') ← ((SubVerso.Examples.checkSignature name sig).run cmdCtx).run cmdState
setInfoState st'.infoState
pure hls
pure (Highlighted.seq hls)
catch e =>
let fmt ← PrettyPrinter.ppSignature (TSyntax.mk name.raw[0]).getId
Suggestion.saveSuggestion str (fmt.fmt.pretty 60) (fmt.fmt.pretty 30 ++ "\n")
throw e

let hls :=
if let some col := col? then
hls.deIndent col
else hls

if «show» then
pure #[← `(Block.other {Block.signature with data := ToJson.toJson $(quote (Highlighted.seq hls))} #[Block.code $(quote str.getString)])]
pure #[← `(Block.other {Block.signature with data := ToJson.toJson $(quote hls)} #[Block.code $(quote str.getString)])]
else
pure #[]

Expand Down
10 changes: 9 additions & 1 deletion Manual/Meta/Tactics.lean
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,19 @@ def proofStateStyle := r#"
padding: 0;
border: none;
}

.hl.lean.tactic-view .tactic-state .goal {
margin-top: 1em;
margin-bottom: 1em;
display: block;
}
.hl.lean.tactic-view .tactic-state .goal:first-child {
margin-top: 0.25em;
}
.hl.lean.tactic-view .tactic-state .goal:last-child {
margin-bottom: 0.25em;
}


"#


Expand Down
Loading