Skip to content

Commit

Permalink
Merge pull request #41 from lean-dojo/dev
Browse files Browse the repository at this point in the history
Detect if theorem name is contained
  • Loading branch information
Peiyang-Song authored Dec 9, 2023
2 parents 9466fac + 50b6f68 commit 26304de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion LeanCopilot/Tactics.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Lean
import LeanCopilot.Options
import LeanCopilot.Frontend
import Aesop.Util.Basic
import Std.Data.String.Basic

open Lean Meta Elab Term Tactic

Expand Down Expand Up @@ -37,14 +38,15 @@ def suggestTactics (targetPrefix : String) : TacticM (Array (String × Float)) :
let theoremName := match ((← getDeclName?).get!).toString with
| "_example" => ""
| n => n
let theoremNameMatcher := String.Matcher.ofString theoremName
if ← isVerbose then
logInfo s!"State:\n{state}"
logInfo s!"Theorem name:¬{theoremName}"
let nm ← getGeneratorName
let model ← getGenerator nm
let suggestions ← generate model state targetPrefix
let filteredSuggestions := suggestions.filterMap fun ((t, s) : String × Float) =>
if (t == theoremName) ∨ (t == "aesop") then none else some (t, s)
if (¬ (theoremName == "") ∧ (Option.isSome <| theoremNameMatcher.find? t)) ∨ (t == "aesop") then none else some (t, s)
return filteredSuggestions


Expand Down

0 comments on commit 26304de

Please sign in to comment.