Skip to content

Commit

Permalink
Adding some duper.delabFact.debug trace messages
Browse files Browse the repository at this point in the history
  • Loading branch information
JOSHCLUNE committed Nov 30, 2024
1 parent 530b94e commit 514dbba
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Duper/Tactic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ def elabFact (stx : Term) : TacticM (Array (Expr × Expr × Array Name)) := do
ret := ret.append (← eqns.mapM fun eq => do elabFactAux (← `($(mkIdent eq))))
trace[duper.elabFact.debug] "Adding definition {expr} as the following facts: {ret.map (fun x => x.1)}"
return ret
| some (.axiomInfo _) => return #[← elabFactAux stx]
| some (.thmInfo _) => return #[← elabFactAux stx]
| some (.axiomInfo _) =>
let ret ← elabFactAux stx
trace[duper.elabFact.debug] "Adding axiom {stx} as the following fact: {ret.1}"
return #[ret]
| some (.thmInfo _) =>
let ret ← elabFactAux stx
trace[duper.elabFact.debug] "Adding theorem {stx} as the following fact: {ret.1}"
return #[ret]
| some (.opaqueInfo _) =>
if ← getIgnoreUnusableFactsM then
trace[duper.ignoredUnusableFacts] "Ignored {expr} ({id}) because it is an opaque constant"
Expand Down Expand Up @@ -130,10 +136,16 @@ def elabFact (stx : Term) : TacticM (Array (Expr × Expr × Array Name)) := do
throwError "Unknown constant {id}"
| .fvar exprFVarId =>
match (← getLCtx).find? exprFVarId with
| some _ => return #[← elabFactAux stx]
| some _ =>
let ret ← elabFactAux stx
trace[duper.elabFact.debug] "Adding fvar {stx} as the following fact: {ret.1}"
return #[ret]
| none => throwError "Unknown fvar {id}"
| _ => throwError "Unknown identifier {id}"
| _ => return #[← elabFactAux stx]
| _ =>
let ret ← elabFactAux stx
trace[duper.elabFact.debug] "Adding {stx} as the following fact: {ret.1}"
return #[ret]
where elabFactAux (stx : Term) : TacticM (Expr × Expr × Array Name) :=
-- elaborate term as much as possible and abstract any remaining mvars:
Term.withoutModifyingElabMetaStateWithInfo <| withRef stx <| Term.withoutErrToSorry do
Expand Down

0 comments on commit 514dbba

Please sign in to comment.