Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion. • 103 items • Updated • 3
statement stringlengths 1 2.11k | proof stringlengths 0 6.42k | type stringclasses 11
values | symbolic_name stringlengths 1 57 | library stringclasses 25
values | filename stringclasses 212
values | imports listlengths 0 3 | deps listlengths 0 20 | docstring stringclasses 204
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
BaseM.State where
/-- The rule pattern cache. -/
rulePatternCache : RulePatternCache
/-- Stats collected during an Aesop call. -/
stats : Stats
deriving Inhabited | structure | Aesop.BaseM.State | Root | Aesop/BaseM.lean | [] | [] | State of the `BaseM` monad. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
BaseM | StateRefT BaseM.State MetaM | abbrev | Aesop.BaseM | Root | Aesop/BaseM.lean | [] | [] | Aesop's base monad. Contains no interesting data, only various caches and
stats. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 |
run (x : BaseM α) (stats : Stats := ∅) : MetaM (α × Stats) | do
let (a, s) ← StateRefT'.run x { stats, rulePatternCache := ∅ }
return (a, s.stats) | def | Aesop.BaseM.run | Root | Aesop/BaseM.lean | [] | [] | Run a `BaseM` action. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 |
not_intro (h : P → False) : ¬ P | h | theorem | Aesop.BuiltinRules.not_intro | Root | Aesop/BuiltinRules.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
empty_false (h : Empty) : False | nomatch h | theorem | Aesop.BuiltinRules.empty_false | Root | Aesop/BuiltinRules.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
pEmpty_false (h : PEmpty) : False | nomatch h | theorem | Aesop.BuiltinRules.pEmpty_false | Root | Aesop/BuiltinRules.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
heq_iff_eq (x y : α) : x ≍ y ↔ x = y | ⟨eq_of_heq, heq_of_eq⟩ | theorem | Aesop.BuiltinRules.heq_iff_eq | Root | Aesop/BuiltinRules.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
Check where
toOption : Lean.Option Bool | structure | Aesop.Check | Root | Aesop/Check.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
get (opts : Options) (opt : Check) : Bool | if let some val := opt.toOption.get? opts then
val
else
Check.all.get opts | def | Aesop.Check.get | Root | Aesop/Check.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
isEnabled [Monad m] [MonadOptions m] (opt : Check) : m Bool | return opt.get (← getOptions) | def | Aesop.Check.isEnabled | Root | Aesop/Check.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
name (opt : Check) : Name | opt.toOption.name | def | Aesop.Check.name | Root | Aesop/Check.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
"register_aesop_check_option" optName:ident descr:str : command =>
`(initialize option : Lean.Option Bool ←
Lean.Option.register $(quote $ `aesop.check ++ optName.getId)
{ defValue := false, descr := $descr }
def $(mkIdent $ `Check ++ optName.getId) : Aesop.Check := ⟨option⟩)
register_aesop_check_... | macro | register_aesop_check_option | Root | Aesop/Check.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
unificationGoalPenalty : Percent | ⟨0.8⟩ | def | Aesop.unificationGoalPenalty | Root | Aesop/Constants.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
postponedSafeRuleSuccessProbability : Percent | ⟨0.9⟩ | def | Aesop.postponedSafeRuleSuccessProbability | Root | Aesop/Constants.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
Context where
parsePriorities : Bool
goal : MVarId | structure | Aesop.ElabM.Context | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
forAdditionalRules (goal : MVarId) : Context | where
parsePriorities := true
goal := goal | def | Aesop.ElabM.Context.forAdditionalRules | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
forAdditionalGlobalRules : MetaM Context | do
let mvarId := (← mkFreshExprMVarAt {} {} (.const ``True [])).mvarId!
return .forAdditionalRules mvarId | def | Aesop.ElabM.Context.forAdditionalGlobalRules | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
forErasing (goal : MVarId) : Context | where
parsePriorities := false
goal := goal | def | Aesop.ElabM.Context.forErasing | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
forGlobalErasing : MetaM Context | do
let mvarId := (← mkFreshExprMVarAt {} {} (.const ``True [])).mvarId!
return .forErasing mvarId | def | Aesop.ElabM.Context.forGlobalErasing | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
ElabM | ReaderT ElabM.Context $ TermElabM | abbrev | Aesop.ElabM.ElabM | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
ElabM.run (ctx : Context) (x : ElabM α) : TermElabM α | do
ReaderT.run x ctx | def | Aesop.ElabM.ElabM.run | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
shouldParsePriorities : ElabM Bool | return (← read).parsePriorities | def | Aesop.ElabM.shouldParsePriorities | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
getGoal : ElabM MVarId | return (← read).goal | def | Aesop.ElabM.getGoal | Root | Aesop/ElabM.lean | [
"Lean"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
EMap (α) where
/-- The mappings stored in the map. Defeq expressions are identified, so
for each equivalence class of defeq expressions we only store one
representative. Missing values indicate expressions that were removed from the
map. -/
rep : PArray (Option (Expr × α))
/-- An index for `rep`. For each e... | structure | Aesop.EMap | Root | Aesop/EMap.lean | [] | [] | A map whose keys are expressions. Keys are identified up to defeq. We use
`reducible` transparency and treat metavariables as rigid (i.e.,
unassignable). | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
empty : EMap α | where
rep := .empty
idx := .empty | def | Aesop.EMap.empty | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
foldlM (init : σ) (f : σ → Expr → α → m σ) (map : EMap α) : m σ | map.rep.foldlM (init := init) fun
| s, none => return s
| s, some (e, a) => f s e a | def | Aesop.EMap.foldlM | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
foldl (init : σ) (f : σ → Expr → α → σ) (map : EMap α) : σ | inline <| map.foldlM (m := Id) init f | def | Aesop.EMap.foldl | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
getCandidates (e : Expr) (map : EMap α) : m (Array Nat) | map.idx.getMatch e | def | Aesop.EMap.getCandidates | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
alterM (e : Expr) (f : α → m (Option α × β)) (map : EMap α) :
m (EMap α × Option β) | do
let lctx ← show MetaM _ from getLCtx
let mut rep := map.rep
for i in ← map.getCandidates e do
let some (e', old) := map.rep[i]!
| continue
if e'.hasAnyFVar (! lctx.contains ·) then
rep := rep.set i none
continue
if ← isDefEqReducibleRigid e' e then
let (new?, b) ← f old
... | def | Aesop.EMap.alterM | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
alter (e : Expr) (f : α → Option α × β) (map : EMap α) :
MetaM (EMap α × Option β) | do
inline <| map.alterM e fun a => return f a | def | Aesop.EMap.alter | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
insertNew (e : Expr) (a : α) (map : EMap α) : m (EMap α) | do
let i := map.rep.size
let rep := map.rep.push (e, a)
let idx ← map.idx.insert e i
return { idx, rep } | def | Aesop.EMap.insertNew | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
insertWithM (e : Expr) (f : Option α → m α) (map : EMap α) :
m (EMap α × Option α × α) | do
let (map, vals?) ← map.alterM e fun old => do
let new ← f (some old)
return (new, (old, new))
match vals? with
| none =>
let new ← f none
return (← map.insertNew e new, none, new)
| some (old, new) =>
return (map, old, new) | def | Aesop.EMap.insertWithM | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
insertWith (e : Expr) (f : Option α → α) (map : EMap α) :
MetaM (EMap α × Option α × α) | inline <| map.insertWithM e fun a? => return f a? | def | Aesop.EMap.insertWith | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
insert (e : Expr) (a : α) (map : EMap α) : MetaM (EMap α) | (·.fst) <$> inline (map.insertWithM e (fun _ => return a)) | def | Aesop.EMap.insert | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
singleton (e : Expr) (a : α) : m (EMap α) | EMap.empty.insertNew e a | def | Aesop.EMap.singleton | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
findWithKey? (e : Expr) (map : EMap α) : MetaM (Option (Expr × α)) | do
let lctx ← getLCtx
for i in ← map.getCandidates e do
let some (e', a) := map.rep[i]!
| continue
if e'.hasAnyFVar (! lctx.contains ·) then
continue
if ← isDefEqReducibleRigid e e' then
return some (e', a)
return none | def | Aesop.EMap.findWithKey? | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
find? (e : Expr) (map : EMap α) : MetaM (Option α) | do
return (← inline <| map.findWithKey? e).map (·.2) | def | Aesop.EMap.find? | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
mapM (f : Expr → α → m β) (map : EMap α) : m (EMap β) | do
let rep ← map.rep.mapM fun x? => x?.mapM fun (e, a) => return (e, ← f e a)
return { map with rep } | def | Aesop.EMap.mapM | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
map (f : Expr → α → β) (map : EMap α) : EMap β | map.mapM (m := Id) f | def | Aesop.EMap.map | Root | Aesop/EMap.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
"declare_aesop_exception"
excName:ident idName:ident testName:ident : command =>
`(initialize $idName : InternalExceptionId ←
Lean.registerInternalExceptionId $(quote $ `Aesop ++ excName.getId)
def $excName : Exception :=
.internal $idName
def $testName : Exception → Bool
| .internal i... | macro | declare_aesop_exception | Root | Aesop/Exception.lean | [
"Lean.Exception"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
Index (α : Type) where
byTarget : DiscrTree (Rule α)
byHyp : DiscrTree (Rule α)
unindexed : PHashSet (Rule α)
deriving Inhabited | structure | Aesop.Index | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
trace [ToString (Rule α)] (ri : Index α) (traceOpt : TraceOption) :
CoreM Unit | do
if ! (← traceOpt.isEnabled) then
return
withConstAesopTraceNode traceOpt (return "Indexed by target") do
traceArray ri.byTarget.values
withConstAesopTraceNode traceOpt (return "Indexed by hypotheses") do
traceArray ri.byHyp.values
withConstAesopTraceNode traceOpt (return "Unindexed") do
trace... | def | Aesop.Index.trace | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
merge (ri₁ ri₂ : Index α) : Index α | where
byTarget := ri₁.byTarget.mergePreservingDuplicates ri₂.byTarget
byHyp := ri₁.byHyp.mergePreservingDuplicates ri₂.byHyp
unindexed := ri₁.unindexed.merge ri₂.unindexed | def | Aesop.Index.merge | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
add (r : Rule α) (imode : IndexingMode) (ri : Index α) :
Index α | match imode with
| IndexingMode.unindexed =>
{ ri with unindexed := ri.unindexed.insert r }
| IndexingMode.target keys =>
{ ri with byTarget := ri.byTarget.insertKeyValue keys r }
| IndexingMode.hyps keys =>
{ ri with byHyp := ri.byHyp.insertKeyValue keys r }
| IndexingMode.or imodes =>
imodes.f... | def | Aesop.Index.add | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
unindex (ri : Index α) (p : Rule α → Bool) : Index α | let (byTarget, unindexed) := filterDiscrTree' ri.unindexed ri.byTarget
let (byHyp, unindexed) := filterDiscrTree' unindexed ri.byHyp
{ byTarget, byHyp, unindexed }
where
@[inline, always_inline]
filterDiscrTree' (unindexed : PHashSet (Rule α)) (t : DiscrTree (Rule α)) :
DiscrTree (Rule α) × PHa... | def | Aesop.Index.unindex | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
foldM [Monad m] (ri : Index α) (f : σ → Rule α → m σ) (init : σ) : m σ | match ri with
| { byHyp, byTarget, unindexed} => do
let mut s := init
s ← byHyp.foldValuesM (init := s) f
s ← byTarget.foldValuesM (init := s) f
unindexed.foldM (init := s) f | def | Aesop.Index.foldM | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
fold (ri : Index α) (f : σ → Rule α → σ) (init : σ) : σ | Id.run $ ri.foldM (init := init) f | def | Aesop.Index.fold | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
applicableByTargetRules (ri : Index α) (goal : MVarId)
(include? : Rule α → Bool) :
MetaM (Array (Rule α × Array IndexMatchLocation)) | goal.withContext do
let rules ← getUnify ri.byTarget (← goal.getType)
let mut rs := Array.mkEmpty rules.size
-- Assumption: include? is true for most rules.
for r in rules do
if include? r then
rs := rs.push (r, #[.target])
return rs | def | Aesop.Index.applicableByTargetRules | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
applicableByHypRules (ri : Index α) (goal : MVarId)
(include? : Rule α → Bool) :
MetaM (Array (Rule α × Array IndexMatchLocation)) | goal.withContext do
let mut rs := #[]
for localDecl in ← getLCtx do
if localDecl.isImplementationDetail then
continue
let rules ← getUnify ri.byHyp localDecl.type
for r in rules do
if include? r then
rs := rs.push (r, #[.hyp localDecl])
return rs | def | Aesop.Index.applicableByHypRules | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
applicableUnindexedRules (ri : Index α) (include? : Rule α → Bool) :
Array (Rule α × Array IndexMatchLocation) | ri.unindexed.fold (init := #[]) λ acc r =>
if include? r then
acc.push (r, #[.none])
else
acc | def | Aesop.Index.applicableUnindexedRules | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
applicableRules (ri : Index α) (goal : MVarId)
(patSubstMap : RulePatternSubstMap)
(additionalRules : Array (IndexMatchResult (Rule α)))
(include? : Rule α → Bool) :
MetaM (Array (IndexMatchResult (Rule α))) | do
withConstAesopTraceNode .debug (return "rule selection") do
goal.instantiateMVars
let result ← addRules additionalRules #[
(← applicableByTargetRules ri goal include?),
(← applicableByHypRules ri goal include?),
(applicableUnindexedRules ri include?)
]
let result := result.qsort λ x y => x.rule... | def | Aesop.Index.applicableRules | Root | Aesop/Index.lean | [
"Batteries.Lean.PersistentHashSet",
"Batteries.Lean.Meta.DiscrTree"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
evalAesop : Tactic | λ stx => do
profileitM Exception "aesop" (← getOptions) do
let goal ← getMainGoal
goal.withContext do
let (solved, stats) ← go stx goal |>.run ∅
stats.trace .stats
recordStatsForCurrentFileIfEnabled stx stats
appendStatsToStatsFileIfEnabled stx stats solved
where
go (stx : Syntax) (goal : MVarId... | def | Aesop.evalAesop | Root | Aesop/Main.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
Nanos where
nanos : Nat
deriving Inhabited, BEq, Ord | structure | Aesop.Nanos | Root | Aesop/Nanos.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
printAsMillis (n : Nanos) : String | let str := toString (n.nanos.toFloat / 1000000)
match str.splitToList λ c => c == '.' with
| [beforePoint] => beforePoint ++ "ms"
| [beforePoint, afterPoint] => beforePoint ++ "." ++ afterPoint.take 1 ++ "ms"
| _ => unreachable! | def | Aesop.Nanos.printAsMillis | Root | Aesop/Nanos.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
Percent where
toFloat : Float
deriving Inhabited | structure | Aesop.Percent | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
ofFloat (f : Float) : Option Percent | if 0 <= f && f <= 1.0 then some ⟨f⟩ else none | def | Aesop.Percent.ofFloat | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
δ : Percent | ⟨0.00001⟩ | def | Aesop.Percent.δ | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
hundred : Percent | ⟨1⟩ | def | Aesop.Percent.hundred | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
fifty : Percent | ⟨0.5⟩ | def | Aesop.Percent.fifty | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
toHumanString (p : Percent) : String | let str := toString (p.toFloat * 100)
match str.splitToList λ c => c == '.' with
| [beforePoint] => beforePoint ++ "%"
| [beforePoint, afterPoint] =>
beforePoint ++ "." ++ afterPoint.take 4 ++ "%"
| _ => unreachable! | def | Aesop.Percent.toHumanString | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
ofNat (n : Nat) : Option Percent | Percent.ofFloat $ n.toFloat / 100 | def | Aesop.Percent.ofNat | Root | Aesop/Percent.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
NormRuleInfo where
penalty : Int
deriving Inhabited | structure | Aesop.NormRuleInfo | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
NormRule | Rule NormRuleInfo | abbrev | Aesop.NormRule | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
defaultNormPenalty : Int | 1 | def | Aesop.defaultNormPenalty | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
defaultSimpRulePriority : Int | eval_prio default | def | Aesop.defaultSimpRulePriority | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
Safety
| safe
| almostSafe
deriving Inhabited | inductive | Aesop.Safety | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
SafeRuleInfo where
penalty : Int
safety : Safety
deriving Inhabited | structure | Aesop.SafeRuleInfo | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
SafeRule | Rule SafeRuleInfo | abbrev | Aesop.SafeRule | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
defaultSafePenalty : Int | 1 | def | Aesop.defaultSafePenalty | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
UnsafeRuleInfo where
successProbability : Percent
deriving Inhabited | structure | Aesop.UnsafeRuleInfo | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
UnsafeRule | Rule UnsafeRuleInfo | abbrev | Aesop.UnsafeRule | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
defaultSuccessProbability : Percent | .fifty | def | Aesop.defaultSuccessProbability | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
RegularRule
| safe (r : SafeRule)
| «unsafe» (r : UnsafeRule)
deriving Inhabited, BEq | inductive | Aesop.RegularRule | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
successProbability : RegularRule → Percent | | safe _ => Percent.hundred
| «unsafe» r => r.extra.successProbability | def | Aesop.RegularRule.successProbability | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
isSafe : RegularRule → Bool | | safe _ => true
| «unsafe» _ => false | def | Aesop.RegularRule.isSafe | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
isUnsafe : RegularRule → Bool | | safe _ => false
| «unsafe» _ => true | def | Aesop.RegularRule.isUnsafe | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
withRule (f : ∀ {α}, Rule α → β) : RegularRule → β | | safe r => f r
| «unsafe» r => f r | def | Aesop.RegularRule.withRule | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
name (r : RegularRule) : RuleName | r.withRule (·.name) | def | Aesop.RegularRule.name | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
indexingMode (r : RegularRule) : IndexingMode | r.withRule (·.indexingMode) | def | Aesop.RegularRule.indexingMode | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
tac (r : RegularRule) : RuleTacDescr | r.withRule (·.tac) | def | Aesop.RegularRule.tac | Root | Aesop/Rule.lean | [] | [
"tac"
] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
NormSimpRule where
name : RuleName
entries : Array SimpEntry
deriving Inhabited | structure | Aesop.NormSimpRule | Root | Aesop/Rule.lean | [] | [] | A global rule for the norm simplifier. Each `SimpEntry` represents a member
of the simp set, e.g. a declaration whose type is an equality or a smart
unfolding theorem for a declaration. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
LocalNormSimpRule where
id : Name
simpTheorem : Term
deriving Inhabited | structure | Aesop.LocalNormSimpRule | Root | Aesop/Rule.lean | [] | [] | A local rule for the norm simplifier. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
name (r : LocalNormSimpRule) : RuleName | { name := r.id, scope := .local, builder := .simp, phase := .norm } | def | Aesop.LocalNormSimpRule.name | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
UnfoldRule where
decl : Name
unfoldThm? : Option Name
deriving Inhabited | structure | Aesop.UnfoldRule | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | ||
name (r : UnfoldRule) : RuleName | { name := r.decl, builder := .unfold, phase := .norm, scope := .global } | def | Aesop.UnfoldRule.name | Root | Aesop/Rule.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
RulePattern where
/--
An expression of the form `λ y₀ ... yₖ, p` representing the
pattern.
-/
pattern : AbstractMVarsResult
/--
A partial map from the index set `{0, ..., n-1}` into `{0, ..., k-1}`. If
`argMap[i] = j`, this indicates that when matching against the rule type, the
instantiation `tⱼ` of ... | structure | Aesop.RulePattern | Root | Aesop/RulePattern.lean | [] | [] | A rule pattern. For a rule of type `∀ (x₀ : T₀) ... (xₙ : Tₙ), U`, a valid rule
pattern is an expression `p` such that `x₀ : T₁, ..., xₙ : Tₙ ⊢ p : P`. Let
`y₀, ..., yₖ` be those variables `xᵢ` on which `p` depends. When `p` matches an
expression `e`, this means that `e` is defeq to `p` (where each `yᵢ` is replaced
wit... | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
boundPremises (pat : RulePattern) : Array Nat | Id.run do
let mut result := Array.mkEmpty pat.argMap.size
for h : i in [:pat.argMap.size] do
if pat.argMap[i].isSome then
result := result.push i
return result | def | Aesop.RulePattern.boundPremises | Root | Aesop/RulePattern.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
«open» (pat : RulePattern) :
MetaM (Array MVarId × Array LMVarId × Expr) | do
let a := pat.pattern
let us ← a.paramNames.mapM fun _ => mkFreshLevelMVar
let e := a.expr.instantiateLevelParamsArray a.paramNames us
let (mvars, _, e) ← lambdaMetaTelescope e (some a.numMVars)
return (mvars.map (·.mvarId!), us.map (·.mvarId!) , e) | def | Aesop.RulePattern.«open» | Root | Aesop/RulePattern.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
«match» (e : Expr) (pat : RulePattern) : BaseM (Option Substitution) | withNewMCtxDepth do
let (mvarIds, lmvarIds, p) ← pat.open
if ! (← isDefEq e p) then
return none
let mut subst := .empty pat.argMap.size pat.levelArgMap.size
for h : i in [:pat.argMap.size] do
if let some j := pat.argMap[i] then
let mvarId := mvarIds[j]!
let mvar := .mvar mvar... | def | Aesop.RulePattern.«match» | Root | Aesop/RulePattern.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
«elab» (stx : Term) (rule : Expr) : TermElabM RulePattern | withConstAesopTraceNode .debug (return m!"elaborating rule pattern") do
-- TODO withNewMCtxDepth produces an error, but I don't understand why
withLCtx {} {} $ withoutModifyingState do
aesop_trace[debug] "rule: {rule}"
aesop_trace[debug] "pattern: {stx}"
let lmvarIds := collectLevelMVars {} (← instanti... | def | Aesop.RulePattern.«elab» | Root | Aesop/RulePattern.lean | [] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
BaseRuleSet where
/--
Normalisation rules registered in this rule set.
-/
normRules : Index NormRuleInfo
/--
Unsafe rules registered in this rule set.
-/
unsafeRules : Index UnsafeRuleInfo
/--
Safe rules registered in this rule set.
-/
safeRules : Index SafeRuleInfo
/--
Rules for the builtin... | structure | Aesop.BaseRuleSet | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | The Aesop-specific parts of an Aesop rule set. A `BaseRuleSet` stores global
Aesop rules, e.g. safe and unsafe rules. It does not store simp theorems for
the builtin norm simp rule; these are instead stored in a simp extension. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
GlobalRuleSet extends BaseRuleSet where
/--
The simp theorems stored in this rule set.
-/
simpTheorems : SimpTheorems
/--
The simprocs stored in this rule set.
-/
simprocs : Simprocs
deriving Inhabited | structure | Aesop.GlobalRuleSet | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | A global Aesop rule set. When we tag a declaration with `@[aesop]`, it is stored
in one or more of these rule sets. Internally, a `GlobalRuleSet` is composed of
a `BaseRuleSet` (stored in an Aesop rule set extension) plus a set of simp
theorems (stored in a `SimpExtension`). | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
LocalRuleSet extends BaseRuleSet where
/--
The simp theorems used by the builtin norm simp rule.
-/
simpTheoremsArray : Array (Name × SimpTheorems)
/--
The simp theorems array must contain at least one `SimpTheorems` structure.
When a simp theorem is added to a `LocalRuleSet`, it is stored in this first
... | structure | Aesop.LocalRuleSet | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | The rule set used by an Aesop tactic call. A local rule set is produced by
combining several global rule sets and possibly adding or erasing some
individual rules. | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
onBaseM [Monad m] (f : BaseRuleSet → m (BaseRuleSet × α))
(rs : GlobalRuleSet) : m (GlobalRuleSet × α) | do
let (toBaseRuleSet, a) ← f rs.toBaseRuleSet
let rs := { rs with toBaseRuleSet }
return (rs, a) | def | Aesop.GlobalRuleSet.onBaseM | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
onBase (f : BaseRuleSet → BaseRuleSet × α) (rs : GlobalRuleSet) :
GlobalRuleSet × α | rs.onBaseM (m := Id) f | def | Aesop.GlobalRuleSet.onBase | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
modifyBaseM [Monad m] (f : BaseRuleSet → m BaseRuleSet)
(rs : GlobalRuleSet) : m GlobalRuleSet | (·.fst) <$> rs.onBaseM (λ rs => return (← f rs, ())) | def | Aesop.GlobalRuleSet.modifyBaseM | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
modifyBase (f : BaseRuleSet → BaseRuleSet) (rs : GlobalRuleSet) :
GlobalRuleSet | rs.modifyBaseM (m := Id) f | def | Aesop.GlobalRuleSet.modifyBase | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
onBaseM [Monad m] (f : BaseRuleSet → m (BaseRuleSet × α))
(rs : LocalRuleSet) : m (LocalRuleSet × α) | do
let (toBaseRuleSet, a) ← f rs.toBaseRuleSet
return ({ rs with toBaseRuleSet }, a) | def | Aesop.LocalRuleSet.onBaseM | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
onBase (f : BaseRuleSet → (BaseRuleSet × α)) (rs : LocalRuleSet) :
LocalRuleSet × α | rs.onBaseM (m := Id) f | def | Aesop.LocalRuleSet.onBase | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 | |
modifyBaseM [Monad m] (f : BaseRuleSet → m BaseRuleSet) (rs : LocalRuleSet) :
m LocalRuleSet | (·.fst) <$> rs.onBaseM (λ rs => return (← f rs, ())) | def | Aesop.LocalRuleSet.modifyBaseM | Root | Aesop/RuleSet.lean | [
"Batteries.Lean.PersistentHashMap",
"Batteries.Lean.PersistentHashSet"
] | [] | https://github.com/leanprover-community/aesop | fafca80479ff95e041d84373dda7122adf1295f2 |
Structured dataset from Aesop — White-box proof search automation.
fafca80479ff95e041d84373dda7122adf1295f2| 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 |
| Type | Count |
|---|---|
| def | 1,273 |
| theorem | 302 |
| structure | 140 |
| inductive | 90 |
| axiom | 89 |
| abbrev | 49 |
| opaque | 12 |
| macro | 10 |
| class | 9 |
| elab | 5 |
| instance | 4 |
run (x : BaseM α) (stats : Stats := ∅) : MetaM (α × Stats)
do
let (a, s) ← StateRefT'.run x { stats, rulePatternCache := ∅ }
return (a, s.stats)
Aesop.BaseM.run | Aesop/BaseM.leanEach 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.
@misc{lean4_aesop_dataset,
title = {Lean4-Aesop},
author = {Norton, Charles},
year = {2026},
note = {Extracted from https://github.com/leanprover-community/aesop, commit fafca80479ff},
url = {https://huggingface.co/datasets/phanerozoic/Lean4-Aesop}
}