Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion. • 103 items • Updated • 3
statement stringlengths 1 2.2k | proof stringlengths 0 99.7k | type stringclasses 11
values | symbolic_name stringlengths 1 63 | library stringclasses 9
values | filename stringclasses 122
values | imports listlengths 0 35 | deps listlengths 0 64 | docstring stringlengths 0 1.91k | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
runDuperOnTPTP (fileName : String) (formulas : List (Expr × Expr × Array Name × Bool)) (instanceMaxHeartbeats : Nat) : MetaM Unit | do
let generateDatatypeExhaustivenessFacts ← getCollectDataTypesM
let state ←
withNewMCtxDepth do
let formulas ← unfoldDefinitions (formulas.map (fun (e, proof, paramNames, isFromGoal) => (e, proof, paramNames, isFromGoal, true)))
/- `collectAssumptions` should not be wrapped by `withoutModifyingCor... | def | runDuperOnTPTP | Root | Main.lean | [
"Duper",
"Duper.TPTP",
"Duper.TPTPParser.PrattParser"
] | [] | Entry point for calling a single instance of duper using the options determined by (← getOptions).
Formulas should consist of lemmas supplied by the user (to see how to obtain formulas from duper's input syntax, see `collectAssumptions`).
InstanceMaxHeartbeats should indicate how many heartbeats duper should r... | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
run (path : String) (_github : Bool) : MetaM Unit | do
let prop := mkSort Level.zero
let type := mkSort Level.one
let sortu := mkSort (.param `u)
let sortu1 := mkSort (.param `u1)
let sortu2 := mkSort (.param `u2)
addDecl (.axiomDecl {name := `Nat, levelParams := [], type := type, isUnsafe := false})
addDecl (.axiomDecl {name := `Iota, levelParams := [], t... | def | run | Root | Main.lean | [
"Duper",
"Duper.TPTP",
"Duper.TPTPParser.PrattParser"
] | [
"Duper.Skolem.some",
"Iota",
"TPTP.compileFile",
"runDuperOnTPTP"
] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
main : List String → IO UInt32 | fun args => do
if args.length == 0 then
println! "Please provide problem file."
return 1
else
let env ← mkEmptyEnvironment
let github := (args.length > 1 && args[1]! == "--github")
let maxHeartbeats := if github then 50 * 1000 * 1000 else 0
let _ ← Meta.MetaM.toIO
(ctxCore := {fileName... | def | main | Root | Main.lean | [
"Duper",
"Duper.TPTP",
"Duper.TPTPParser.PrattParser"
] | [
"run"
] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
backwardSimpRules : ProverM (Array BackwardSimpRule) | do
let subsumptionTrie ← getSubsumptionTrie
return #[
(backwardDemodulation (← getDemodMainPremiseIdx)).toBackwardSimpRule,
(backwardClauseSubsumption subsumptionTrie).toBackwardSimpRule,
(backwardEqualitySubsumption subsumptionTrie).toBackwardSimpRule,
(backwardContextualLiteralCutting subsumptionT... | def | Duper.ProverM.backwardSimpRules | Root | Duper/BackwardSimplification.lean | [
"Duper.ProverM",
"Duper.Simp",
"Duper.Rules.ClauseSubsumption",
"Duper.Rules.ContextualLiteralCutting",
"Duper.Rules.Demodulation",
"Duper.Rules.EqualitySubsumption",
"Duper.Rules.SimplifyReflect"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
backwardSimplify (givenClause : Clause) : ProverM Unit | do
trace[duper.prover.saturate] "backward simplify with {givenClause}"
let backwardSimpRules ← backwardSimpRules
for i in [0 : backwardSimpRules.size] do
let simpRule := backwardSimpRules[i]!
simpRule givenClause | def | Duper.ProverM.backwardSimplify | Root | Duper/BackwardSimplification.lean | [
"Duper.ProverM",
"Duper.Simp",
"Duper.Rules.ClauseSubsumption",
"Duper.Rules.ContextualLiteralCutting",
"Duper.Rules.Demodulation",
"Duper.Rules.EqualitySubsumption",
"Duper.Rules.SimplifyReflect"
] | [] | Uses the givenClause to attempt to simplify other clauses in the active set. For each clause that backwardSimplify is
able to produce a simplification for, backwardSimplify removes the clause adds any newly simplified clauses to the passive set.
Additionally, for each clause removed from the active set in this ... | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
Lit where
sign : Bool
lvl : Level
ty : Expr
lhs : Expr
rhs : Expr
deriving Inhabited, BEq, Hashable | structure | Duper.Lit | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
LitSide | lhs | rhs
deriving Inhabited, BEq, Hashable | inductive | Duper.LitSide | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
Lit.toString (l : Lit) | ToString.toString l.lhs ++ if l.sign then " = " else " ≠ " ++ ToString.toString l.rhs | def | Duper.Lit.toString | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
LitSide.format (ls : LitSide) : MessageData | match ls with
| lhs => m!"lhs"
| rhs => m!"rhs" | def | Duper.LitSide.format | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
toggleSide (side : LitSide) : LitSide | match side with
| LitSide.lhs => LitSide.rhs
| LitSide.rhs => LitSide.lhs | def | Duper.LitSide.toggleSide | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
LitPos where
side : LitSide
pos : ExprPos
deriving Inhabited, BEq, Hashable | structure | Duper.LitPos | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
toExpr (lit : Lit) : Expr | if lit.sign
then mkApp3 (mkConst ``Eq [lit.lvl]) lit.ty lit.lhs lit.rhs
else mkApp3 (mkConst ``Ne [lit.lvl]) lit.ty lit.lhs lit.rhs | def | Duper.Lit.toExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
fromSingleExpr (e : Expr) (sign := true) : Lit | Lit.mk
(sign := true)
(lvl := Level.one)
(ty := mkSort Level.zero)
(lhs := Expr.consumeMData e)
(rhs := if sign then mkConst ``True else mkConst ``False) | def | Duper.Lit.fromSingleExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
fromExpr : Expr → Lit | | .app (.app (.app (.const ``Eq lvl) ty) lhs) rhs =>
⟨true, lvl[0]!, ty, lhs, rhs⟩
| .app (.app (.app (.const ``Ne lvl) ty) lhs) rhs =>
⟨false, lvl[0]!, ty, lhs, rhs⟩
| e@(_) => dbg_trace "Lit.fromExpr :: Unexpected Expression: {e}"; Lit.fromSingleExpr e | def | Duper.Lit.fromExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
map (f : Expr → Expr) (l : Lit) | -- Should we really map into `ty`?
{l with ty := f l.ty, lhs := f l.lhs, rhs := f l.rhs} | def | Duper.Lit.map | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
instantiateLevelParamsArray (l : Lit) (paramNames : Array Name) (levels : Array Level) | {l with lvl := l.lvl.instantiateParams paramNames.toList levels.toList
ty := l.ty.instantiateLevelParamsArray paramNames levels
lhs := l.lhs.instantiateLevelParamsArray paramNames levels
rhs := l.rhs.instantiateLevelParamsArray paramNames levels} | def | Duper.Lit.instantiateLevelParamsArray | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mapWithPos (f : Expr → Expr × Array ExprPos) (l : Lit) | let (l', lposes) := f l.lhs
let (r', rposes) := f l.rhs
-- Does not map into `ty`
let lit' := {l with lhs := l', rhs := r'}
let lp' := lposes.map (fun p => LitPos.mk .lhs p)
let rp' := rposes.map (fun p => LitPos.mk .rhs p)
(lit', lp' ++ rp') | def | Duper.Lit.mapWithPos | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mapMWithPos [Monad m] [MonadLiftT MetaM m] (f : Expr → m (Expr × Array ExprPos)) (l : Lit) : m (Lit × Array LitPos) | do
let (l', lposes) ← f l.lhs
let (r', rposes) ← f l.rhs
-- Does not map into `ty`
let lit' := {l with lhs := l', rhs := r'}
let lp' := lposes.map (fun p => LitPos.mk .lhs p)
let rp' := rposes.map (fun p => LitPos.mk .rhs p)
return (lit', lp' ++ rp') | def | Duper.Lit.mapMWithPos | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mapByPos (f : Expr → Array ExprPos → Expr) (l : Lit) (poses : Array LitPos) | Id.run <| do
let mut lposes := #[]
let mut rposes := #[]
for ⟨side, pos⟩ in poses do
if side == .lhs then
lposes := lposes.push pos
else
rposes := rposes.push pos
-- Does not map into `ty`
let l' := f l.lhs lposes
let r' := f l.rhs rposes
return {l with lhs := l', rhs := r'} | def | Duper.Lit.mapByPos | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mapMByPos [Monad m] [MonadLiftT MetaM m] (f : Expr → Array ExprPos → m Expr) (l : Lit) (poses : Array LitPos) : m Lit | do
let mut lposes := #[]
let mut rposes := #[]
for ⟨side, pos⟩ in poses do
if side == .lhs then
lposes := lposes.push pos
else
rposes := rposes.push pos
-- Does not map into `ty`
let l' ← f l.lhs lposes
let r' ← f l.rhs rposes
return {l with lhs := l', rhs := r'} | def | Duper.Lit.mapMByPos | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mapM {m : Type → Type w} [Monad m] (f : Expr → m Expr) (l : Lit) : m Lit | do
return {l with ty := ← f l.ty, lhs := ← f l.lhs, rhs := ← f l.rhs} | def | Duper.Lit.mapM | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
fold {α : Type v} (f : α → Expr → α) (init : α) (l : Lit) : α | f (f init l.lhs) l.rhs | def | Duper.Lit.fold | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
foldWithTypeM {β : Type v} {m : Type v → Type w} [Monad m]
(f : β → Expr → m β) (init : β) (l : Lit) : m β | do
f (← f (← f init l.ty) l.lhs) l.rhs | def | Duper.Lit.foldWithTypeM | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
foldM {β : Type v} {m : Type v → Type w} [Monad m]
(f : β → Expr → LitPos → m β) (init : β) (l : Lit) : m β | do
f (← f init l.lhs ⟨LitSide.lhs, ExprPos.empty⟩) l.rhs ⟨LitSide.rhs, ExprPos.empty⟩ | def | Duper.Lit.foldM | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
foldGreenM {β : Type} [Monad m] [MonadLiftT MetaM m]
(f : β → Expr → LitPos → m β) (init : β) (l : Lit) : m β | do
let fLhs := fun acc e p => f acc e ⟨LitSide.lhs, p⟩
let fRhs := fun acc e p => f acc e ⟨LitSide.rhs, p⟩
l.rhs.foldGreenM fRhs (← l.lhs.foldGreenM fLhs init) | def | Duper.Lit.foldGreenM | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getAtPos! [Monad m] [MonadLiftT MetaM m] (l : Lit) (pos : LitPos) : m Expr | match pos.side with
| LitSide.lhs => l.lhs.getAtPos! pos.pos
| LitSide.rhs => l.rhs.getAtPos! pos.pos | def | Duper.Lit.getAtPos! | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
replaceAtPos? [Monad m] [MonadLiftT MetaM m] (l : Lit) (pos : LitPos) (replacement : Expr) : m (Option Lit) | do
match pos.side with
| LitSide.lhs =>
match ← l.lhs.replaceAtPos? pos.pos replacement with
| some newLhs => return some {l with lhs := newLhs}
| none => return none
| LitSide.rhs =>
match ← l.rhs.replaceAtPos? pos.pos replacement with
| some newRhs => return some {l with rhs := newRhs}
|... | def | Duper.Lit.replaceAtPos? | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
replaceAtPos! [Monad m] [MonadLiftT MetaM m] [MonadError m] (l : Lit) (pos : LitPos) (replacement : Expr) : m Lit | match pos.side with
| LitSide.lhs => return {l with lhs := ← l.lhs.replaceAtPos! pos.pos replacement}
| LitSide.rhs => return {l with rhs := ← l.rhs.replaceAtPos! pos.pos replacement} | def | Duper.Lit.replaceAtPos! | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
replaceAtPosUpdateType? (l : Lit) (pos : LitPos) (replacement : Expr) : MetaM (Option Lit) | do
let repPos ← replaceAtPos! l pos replacement
try
let ty ← Meta.inferType repPos.lhs
let sort ← Meta.inferType ty
let sortReduced ← Meta.reduce sort false false true
if ! sortReduced.isSort then
trace[Meta.debug] "replaceAtPosUpdateType? :: {sortReduced} is not a sort"
return none
... | def | Duper.Lit.replaceAtPosUpdateType? | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | Note : This function will throw error if ``pos`` is not a valid ``pos`` for `l` | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
abstractAtPos! (l : Lit) (pos : LitPos) : MetaM Lit | do
match pos.side with
| LitSide.lhs => return {l with lhs := ← l.lhs.abstractAtPos! pos.pos}
| LitSide.rhs => return {l with rhs := ← l.rhs.abstractAtPos! pos.pos} | def | Duper.Lit.abstractAtPos! | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | This function acts as Meta.kabstract except that it takes a LitPos rather than Occurrences and expects
the given expression to consist only of applications up to the given ExprPos. Additionally, since the exact
position is given, we don't need to pass in Meta.kabstract's second argument p | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
symm (l : Lit) : Lit | {l with
lhs := l.rhs
rhs := l.lhs} | def | Duper.Lit.symm | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
makeLhs (lit : Lit) (side : LitSide) | match side with
| LitSide.lhs => lit
| LitSide.rhs => lit.symm | def | Duper.Lit.makeLhs | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getSide (lit : Lit) (side : LitSide) | match side with
| LitSide.lhs => lit.lhs
| LitSide.rhs => lit.rhs | def | Duper.Lit.getSide | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getOtherSide (lit : Lit) (side : LitSide) | getSide lit (LitSide.toggleSide side) | def | Duper.Lit.getOtherSide | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
compare (ord : Expr → Expr → Bool → MetaM Comparison) (alreadyReduced : Bool) (l₁ l₂ : Lit) : MetaM Comparison | do
let l₁ ←
if alreadyReduced then pure l₁
else l₁.mapM (fun e => betaEtaReduceInstMVars e)
let l₂ ←
if alreadyReduced then pure l₂
else l₂.mapM (fun e => betaEtaReduceInstMVars e)
let cll ← ord l₁.lhs l₂.lhs true
if cll == Incomparable then return Incomparable
let clr ← ord l₁.lhs l₂.rhs tru... | def | Duper.Lit.compare | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Clause where
(paramNames : Array Name)
(bVarTypes : Array Expr)
(lits : Array Lit)
deriving Inhabited, BEq, Hashable | structure | Duper.Clause | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
ClausePos extends LitPos where
lit : Nat
deriving Inhabited, BEq, Hashable | structure | Duper.ClausePos | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
ClausePos.format (pos : ClausePos) : MessageData | m!"\{lit: {pos.lit}, side: {pos.side}, ExprPos: {pos.pos}}" | def | Duper.ClausePos.format | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
empty : Clause | ⟨#[], #[], #[]⟩ | def | Duper.Clause.empty | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
fromSingleExpr (paramNames : Array Name) (e : Expr) : Clause | Clause.mk paramNames #[] #[Lit.fromSingleExpr e] | def | Duper.Clause.fromSingleExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
litsToExpr : List Lit → Expr | | [] => mkConst ``False
| [l] => l.toExpr
| l :: ls => mkApp2 (mkConst ``Or) l.toExpr (litsToExpr ls) | def | Duper.Clause.litsToExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
toExpr (c : Clause) : Expr | litsToExpr c.lits.toList | def | Duper.Clause.toExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
foldM {β : Type v} {m : Type v → Type w} [Monad m]
(f : β → Expr → ClausePos → m β) (init : β) (c : Clause) : m β | do
let mut acc := init
for i in [:c.lits.size] do
let f' := fun acc e pos => f acc e {pos with lit := i}
acc ← c.lits[i]!.foldM f' acc
return acc | def | Duper.Clause.foldM | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getAtPos! [Monad m] [MonadLiftT MetaM m] (c : Clause) (pos : ClausePos) : m Expr | c.lits[pos.lit]!.getAtPos! ⟨pos.side, pos.pos⟩ | def | Duper.Clause.getAtPos! | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mapMUpdateType [instMonad : Monad m] (c : Clause) (f : Expr → m Expr) | do
let bVarTypes ← c.bVarTypes.mapM f
let lits ← c.lits.mapM (Lit.mapM f)
return {c with bVarTypes := bVarTypes, lits := lits} | def | Duper.Clause.mapMUpdateType | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
instantiateLevelParamsArray (c : Clause) (paramNames : Array Name) (levels : Array Level) | let bVarTypes := c.bVarTypes.map (fun e => e.instantiateLevelParamsArray paramNames levels)
let lits := c.lits.map (fun l => l.instantiateLevelParamsArray paramNames levels)
{c with bVarTypes := bVarTypes, lits := lits} | def | Duper.Clause.instantiateLevelParamsArray | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
toForallExpr (c : Clause) : Expr | c.bVarTypes.foldr (fun ty b => mkForall Name.anonymous BinderInfo.default ty b) c.toExpr | def | Duper.Clause.toForallExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
toLambdaExpr (c : Clause) : Expr | c.bVarTypes.foldr (fun ty b => mkLambda Name.anonymous BinderInfo.default ty b) c.toExpr | def | Duper.Clause.toLambdaExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
fromForallExpr (paramNames : Array Name) (e : Expr) : Clause | let (bvarTypes, e) := deForall e
⟨paramNames, bvarTypes.toArray, (litsFromExpr e).toArray⟩
where
deForall : Expr → List Expr × Expr
| .forallE _ ty body _ => let (l, e) := deForall body; (ty::l, e)
| e@(_) => ([], e)
litsFromExpr : Expr → List Lit
| .app (.app (.const ``Or _) litexpr) other => Lit.fromExpr ... | def | Duper.Clause.fromForallExpr | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
weight (c : Clause) : Nat | c.lits.foldl (fun acc lit => acc + lit.lhs.weight + lit.rhs.weight) 0 | def | Duper.Clause.weight | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
selectionPrecedence (c : Clause) (goalDistance : Nat) : Nat | /- TODO: Experiment with different coefficients for c.weight and goalDistance. Zipperposition's goal_oriented
clause selection function has (among other heuristics) c.weight given a coefficient of 4 and goalDistance given
a coefficient of 1 (meaning the returned precedence would be `4 * c.weight + goalDistanc... | def | Duper.Clause.selectionPrecedence | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | Determines the precedence clause `c` should have for clause selection. Lower values indicate higher precedence | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
ClauseAndClausePos.format (c : Clause × ClausePos) : MessageData | m!"({c.1}, {c.2})" | def | Duper.Clause.ClauseAndClausePos.format | Root | Duper/Clause.lean | [
"Lean",
"Duper.Util.Misc",
"Duper.Expr",
"Duper.Order"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
kFair | 70 | def | Duper.kFair | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
kBest | 3 | def | Duper.kBest | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
kHighest | 10 | def | Duper.kHighest | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getForceProbeRetry (opts : Options) : Nat | forceProbeRetry.get opts | def | Duper.getForceProbeRetry | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
logForceProbeRetry (max : Nat) : CoreM Unit | do
let msg := s!"forceProbe exceeded iteration limit {max}"
logInfo msg | def | Duper.logForceProbeRetry | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ClauseProof | Clause × Clause × RuleM.Proof | abbrev | Duper.ClauseProof | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ClauseStream.takeAsProverM (cs : ClauseStream)
: ProverM (Option ((Option ClauseProof) × ClauseStream)) | do
-- No more unification problem left
if cs.ug.isEmpty then
return none
let (opu, ug') ← cs.ug.takeWithRetry (kStep.get (← getOptions))
if let some u := opu then
let res ← ProverM.runRuleM <| do
-- set `mctx` as the mctx of the unification problem
setMCtx u.mctx
cs.postUnification
... | def | Duper.ClauseStream.takeAsProverM | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
penalty (c : Clause) : ProverM Nat | pure 1 | def | Duper.penalty | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
updateWeight (α? : Option ClauseProof) (weight : Nat) (nProbed : Nat) : ProverM Nat | do
if let some (clause, _) := α? then
return weight + (← penalty clause) * Nat.max 1 (nProbed - 64)
else
return weight + Nat.max 2 (nProbed - 16) | def | Duper.updateWeight | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ClauseStreamHeap.extractClause {σ} [OptionMStream ProverM σ ClauseProof]
(Q : ClauseStreamHeap σ) (nProbed : Nat) (precs : Array Nat) (s : σ) : ProverM (Option ClauseProof × ClauseStreamHeap σ) | do
have : Inhabited σ := ⟨s⟩
let next? ← MStream.next? s
if let some (α?, stream') := next? then
-- If this stream is not empty, extract clause from the
-- stream and add it back to the heap
let weight₀ := precs[0]!
let weight ← updateWeight α? weight₀ nProbed
let precs' := precs.set! 0 weight... | def | Duper.ClauseStreamHeap.extractClause | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | Following `Making Higher-Order Superposition Work`.
Extract an `Option Clause` from the stream.
Add the rest of the stream to the heap. | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
ClauseStreamHeap.heuristicProbe {σ} [OptionMStream ProverM σ ClauseProof]
(Q : ClauseStreamHeap σ) : ProverM (Array ClauseProof × ClauseStreamHeap σ) | do
let mut collectedClauses := #[]
let mut highestStream := #[]
let mut Q := Q
for _ in List.range kHighest do
let res := Q.deleteMinWithNProbed 0
if let some (str, Q') := res then
highestStream := highestStream.push str
Q := Q'
else
break
for (nProbed, precs, stream) in highestS... | def | Duper.ClauseStreamHeap.heuristicProbe | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ClauseStreamHeap.fairProbe {σ} [OptionMStream ProverM σ ClauseProof]
(nOldest : Nat) (Q : ClauseStreamHeap σ) : ProverM (Array ClauseProof × ClauseStreamHeap σ) | do
let mut collectedClauses := #[]
let mut oldestStream := #[]
let mut Q := Q
for _ in List.range nOldest do
-- Delete min from age heap
let res := Q.deleteMinWithNProbed 1
if let some (str, Q') := res then
oldestStream := oldestStream.push str
Q := Q'
else
break
for (nProbed... | def | Duper.ClauseStreamHeap.fairProbe | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ProverM.postProcessInferenceResult (cp : ClauseProof) : ProverM Unit | do
let (given, c, proof) := cp
let allClauses ← getAllClauses
let parentClauseInfoOpts ← proof.parents.mapM
(fun p =>
match allClauses.get? p.clause with
| some pi => pure pi
| none => throwError "ProverM.postProcessInferenceResult: Unable to find parent clause {p.clause.toForallExpr}")
--... | def | Duper.ProverM.postProcessInferenceResult | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | Here `c` is `simplifiedGivenClause`. This function is responsible for adding results of inference rules to the passive set. | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
ProverM.performInferences (rules : List (Clause → MClause → Nat → RuleM (Array ClauseStream))) (given : Clause) : ProverM Unit | do
trace[duper.prover.saturate] "perform inference with given clause {given}"
let mut cs := #[]
let cInfo ← getClauseInfo! given
let cNum := cInfo.number
for rule in rules do
let curStreams ← runRuleM do
let c ← loadClause given
rule given c cNum
cs := cs.append curStreams
let mut Q ← ge... | def | Duper.ProverM.performInferences | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [
"getClauseInfo!"
] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ProverM.runProbe
(probe : ClauseStreamHeap ClauseStream → ProverM (Array ClauseProof × ClauseStreamHeap ClauseStream)) | do
let Q ← getQStreamSet
let (arrcp, Q') ← probe Q
setQStreamSet Q'
let _ ← arrcp.mapM ProverM.postProcessInferenceResult | def | Duper.ProverM.runProbe | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ProverM.runForceProbe : ProverM Unit | do
let maxIter := getForceProbeRetry (← getOptions)
let mut fpiter := 0
while (← getQStreamSet).size != 0 ∧ (← getPassiveSet).isEmpty do
runProbe (ClauseStreamHeap.fairProbe (← getQStreamSet).size)
fpiter := fpiter + 1
if fpiter >= maxIter then
logForceProbeRetry maxIter
br... | def | Duper.ProverM.runForceProbe | Root | Duper/ClauseStreamHeap.lean | [
"Batteries.Data.BinomialHeap",
"Duper.Util.IdStrategyHeap",
"Duper.Clause",
"Duper.DUnif.UnifRules",
"Duper.ProverM",
"Lean"
] | [] | We have to repeatedly call `runProbe` and test `(← getPassiveSet).isEmpty`
If we return immediately when `fairProbe` yields a nonempty list of clauses, it is possible that all of these clauses
are redundant and `postProcessInferenceResult` will remove all of them, which will cause `saturate` to think that the p... | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
Key where
| const : Name → Nat → Key
| fvar : FVarId → Nat → Key
| lit : Literal → Key
| star : Key
| other : Key
| arrow : Key
| proj : Name → Nat → Key
deriving Inhabited, BEq, Repr | inductive | Duper.Key | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
Key.hash : Key → UInt64 | | Key.const n a => mixHash 5237 $ mixHash (hash n) (hash a)
| Key.fvar n a => mixHash 3541 (hash a) --$ mixHash (hash n) (hash a)
| Key.lit v => mixHash 1879 $ hash v
| Key.star => 7883
| Key.other => 2411
| Key.arrow => 17
| Key.proj s i => mixHash 11 $ mixHash (hash s) (hash i) | def | Duper.Key.hash | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Trie (α : Type) where
| node (vs : Array α) (children : Array (Key × Trie α)) : Trie α | inductive | Duper.Trie | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | ||
DiscrTree (α : Type) where
root : PersistentHashMap Key (Trie α) | {}
filterSet : HashSet Clause := {} | structure | Duper.DiscrTree | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Key.ctorIdx : Key → Nat | | Key.star => 0
| Key.other => 1
| Key.lit .. => 2
| Key.fvar .. => 3
| Key.const .. => 4
| Key.arrow => 5
| Key.proj .. => 6 | def | Duper.Key.ctorIdx | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Key.lt : Key → Key → Bool | | Key.lit v₁, Key.lit v₂ => v₁ < v₂
| Key.fvar n₁ a₁, Key.fvar n₂ a₂ => a₁ < a₂ -- Name.quickLt n₁.name n₂.name || (n₁ == n₂ && a₁ < a₂)
| Key.const n₁ a₁, Key.const n₂ a₂ => Name.quickLt n₁ n₂ || (n₁ == n₂ && a₁ < a₂)
| Key.proj s₁ i₁, Key.proj s₂ i₂ => Name.quickLt s₁ s₂ || (s₁ == s₂ && i₁ < i₂)
... | def | Duper.Key.lt | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Key.format : Key → Format | | Key.star => "*"
| Key.other => "◾"
| Key.lit (Literal.natVal v) => Std.format v
| Key.lit (Literal.strVal v) => repr v
| Key.const k _ => Std.format k
| Key.proj s i => Std.format s ++ "." ++ Std.format i
| Key.fvar k _ => Std.for... | def | Duper.Key.format | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Key.arity : Key → Nat | | Key.const _ a => a
| Key.fvar _ a => a
| Key.arrow => 2
| Key.proj .. => 1
| _ => 0 | def | Duper.Key.arity | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
empty : DiscrTree α | { root := {} } | def | Duper.DiscrTree.empty | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Trie.format [ToMessageData α] : Trie α → MessageData | | Trie.node vs cs => MessageData.group $ MessageData.paren $
"node" ++ (if vs.isEmpty then MessageData.nil else " " ++ toMessageData vs)
++ MessageData.joinSep (cs.toList.map $ fun ⟨k, c⟩ => MessageData.paren (toMessageData k ++ " => " ++ format c)) "," | def | Duper.DiscrTree.Trie.format | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
Trie.formatClause : Trie (Clause × α) → MessageData | | Trie.node vs cs => MessageData.group $ MessageData.paren $
"node" ++ (if vs.isEmpty then MessageData.nil else " " ++ toMessageData (Array.map (fun x => x.1) vs))
++ MessageData.joinSep (cs.toList.map $ fun ⟨k, c⟩ => MessageData.paren (toMessageData k ++ " => " ++ formatClause c)) "," | def | Duper.DiscrTree.Trie.formatClause | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
format [ToMessageData α] (d : DiscrTree α) : MessageData | let (_, r) := d.root.foldl
(fun (p : Bool × MessageData) k c =>
(false, p.2 ++ MessageData.paren (toMessageData k ++ " => " ++ toMessageData c)))
(true, Format.nil)
MessageData.group r | def | Duper.DiscrTree.format | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
formatClauses (d : DiscrTree (Clause × α)) : MessageData | let (_, r) := d.root.foldl
(fun (p : Bool × MessageData) k c =>
(false, p.2 ++ MessageData.paren (toMessageData k ++ " => " ++ toMessageData c)))
(true, Format.nil)
MessageData.group r | def | Duper.DiscrTree.formatClauses | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
tmpMVarId : MVarId | { name := `_discr_tree_tmp } | def | Duper.DiscrTree.tmpMVarId | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
tmpStar | mkMVar tmpMVarId | def | Duper.DiscrTree.tmpStar | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
ignoreArg (a : Expr) (i : Nat) (infos : Array Meta.ParamInfo) : RuleM Bool | do
if h : i < infos.size then
let info := infos.get ⟨i, h⟩
if info.isInstImplicit then
return true
else if info.isImplicit || info.isStrictImplicit then
return not (← Meta.isType a)
else
return false -- Previously: isProof a
else
return false | def | Duper.DiscrTree.ignoreArg | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | Return true iff the argument should be treated as a "wildcard" by the discrimination tree.
- We ignore proofs because of proof irrelevance. It doesn't make sense to try to
index their structure.
- We ignore instance implicit arguments (e.g., `[Add α]`) because they are "morally" canonical.
Moreover, we ma... | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
pushArgsAux (infos : Array Meta.ParamInfo) : Nat → Expr → Array Expr → RuleM (Array Expr) | | i, Expr.app f a, todo => do
if (← ignoreArg a i infos) then
pushArgsAux infos (i-1) f (todo.push tmpStar)
else
pushArgsAux infos (i-1) f (todo.push a)
| _, _, todo => return todo | def | Duper.DiscrTree.pushArgsAux | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mkNoindexAnnotation (e : Expr) : Expr | mkAnnotation `noindex e | def | Duper.DiscrTree.mkNoindexAnnotation | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
hasNoindexAnnotation (e : Expr) : Bool | annotation? `noindex e |>.isSome | def | Duper.DiscrTree.hasNoindexAnnotation | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
pushArgs (root : Bool) (todo : Array Expr) (e : Expr) : RuleM (Key × Array Expr) | do
if hasNoindexAnnotation e then
return (Key.star, todo)
else
let fn := e.getAppFn
let push (k : Key) (nargs : Nat) : RuleM (Key × Array Expr) := do
let info ← Meta.getFunInfoNArgs fn nargs
let todo ← pushArgsAux info.paramInfo (nargs-1) e todo
return (k, todo)
match fn with
|... | def | Duper.DiscrTree.pushArgs | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mkPathAux (root : Bool) (todo : Array Expr) (keys : Array Key) : RuleM (Array Key) | do
if todo.isEmpty then
return keys
else
let e := todo.back
let todo := todo.pop
let (k, todo) ← pushArgs root todo e
mkPathAux false todo (keys.push k) | def | Duper.DiscrTree.mkPathAux | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
initCapacity | 8 | def | Duper.DiscrTree.initCapacity | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
mkPath (e : Expr) : RuleM (Array Key) | do
let todo : Array Expr := Array.mkEmpty initCapacity
let keys : Array Key := Array.mkEmpty initCapacity
mkPathAux (root := true) (todo.push e) keys | def | Duper.DiscrTree.mkPath | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
createNodes (keys : Array Key) (v : α) (i : Nat) : Trie α | if h : i < keys.size then
let k := keys.get ⟨i, h⟩
let c := createNodes keys v (i+1)
Trie.node #[] #[(k, c)]
else
Trie.node #[v] #[] | def | Duper.DiscrTree.createNodes | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
insertVal [BEq α] (vs : Array α) (v : α) : Array α | if vs.contains v then vs else vs.push v | def | Duper.DiscrTree.insertVal | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
insertAux [BEq α] (keys : Array Key) (v : α) : Nat → Trie α → Trie α | | i, Trie.node vs cs =>
if h : i < keys.size then
let k := keys.get ⟨i, h⟩
let c := Id.run $ cs.binInsertM
(fun a b => a.1 < b.1)
(fun ⟨_, s⟩ => let c := insertAux keys v (i+1) s; (k, c)) -- merge with existing
(fun _ => let c := createNodes keys v (i+1); (k, c))
... | def | Duper.DiscrTree.insertAux | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
insertCore [BEq α] (d : DiscrTree α) (keys : Array Key) (v : α) : DiscrTree α | if keys.isEmpty then panic! "invalid key sequence"
else
let k := keys[0]!
match d.root.find? k with
| none =>
let c := createNodes keys v 1
{ d with root := d.root.insert k c }
| some c =>
let c := insertAux keys v 1 c
{ d with root := d.root.insert k c } | def | Duper.DiscrTree.insertCore | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
insert [BEq α] (d : DiscrTree (Clause × α)) (e : Expr) (v : (Clause × α)) : RuleM (DiscrTree (Clause × α)) | do
let keys ← mkPath e
let d := {d with filterSet := d.filterSet.erase v.1} -- In case if v.1 was previously removed, erase v.1 from d.filterSet
return d.insertCore keys v | def | Duper.DiscrTree.insert | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getKeyArgs (e : Expr) (isMatch root : Bool) : RuleM (Key × Array Expr) | do
match e.getAppFn with
| Expr.lit v => return (Key.lit v, #[])
| Expr.const c _ =>
let nargs := e.getAppNumArgs
return (Key.const c nargs, e.getAppRevArgs)
| Expr.fvar fvarId =>
let nargs := e.getAppNumArgs
return (Key.fvar fvarId nargs, e.getAppRevArgs)
| Expr.mvar _ =>
if ... | def | Duper.DiscrTree.getKeyArgs | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getMatchKeyArgs (e : Expr) (root : Bool) : RuleM (Key × Array Expr) | getKeyArgs e (isMatch := true) (root := root) | abbrev | Duper.DiscrTree.getMatchKeyArgs | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getUnifyKeyArgs (e : Expr) (root : Bool) : RuleM (Key × Array Expr) | getKeyArgs e (isMatch := false) (root := root) | abbrev | Duper.DiscrTree.getUnifyKeyArgs | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 | |
getStarResult (d : DiscrTree α) : Array α | let result : Array α := Array.mkEmpty initCapacity
match d.root.find? Key.star with
| none => result
| some (Trie.node vs _) => result ++ vs | def | Duper.DiscrTree.getStarResult | Root | Duper/DiscrTree.lean | [
"Lean",
"Duper.RuleM"
] | [] | https://github.com/leanprover-community/duper | 3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3 |
Structured declarations from Duper - a proof-producing superposition theorem prover for Lean 4. Source: github.com/leanprover-community/duper
3e56459ec9cc7a1b2f6465f5a4208564f9d9d9c3| 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,090 |
| theorem | 334 |
| axiom | 64 |
| structure | 35 |
| abbrev | 34 |
| inductive | 33 |
| opaque | 8 |
| lemma | 6 |
| class | 2 |
| macro | 1 |
| instance | 1 |
backwardSimplify (givenClause : Clause) : ProverM Unit
do
trace[duper.prover.saturate] "backward simplify with {givenClause}"
let backwardSimpRules ← backwardSimpRules
for i in [0 : backwardSimpRules.size] do
let simpRule := backwardSimpRules[i]!
simpRule givenClause
Duper.ProverM.backwardSimplify | Duper/BackwardSimplification.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_duper_dataset,
title = {Lean4-Duper},
author = {Norton, Charles},
year = {2026},
note = {Extracted from https://github.com/leanprover-community/duper, commit 3e56459ec9cc},
url = {https://huggingface.co/datasets/phanerozoic/Lean4-Duper}
}