Skip to content

Commit

Permalink
remove reorderForallInstDep
Browse files Browse the repository at this point in the history
  • Loading branch information
PratherConid committed Nov 21, 2024
1 parent 420bc92 commit 91e5820
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Auto/Tactic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ def unfoldConstAndPreprocessLemma (unfolds : Array Prep.ConstUnfoldInfo) (lem :
let type := Prep.unfoldConsts unfolds type
let type ← Core.betaReduce (← instantiateMVars type)
let lem := {lem with type := type}
let lem ← lem.reorderForallInstDep
return lem

/--
Expand All @@ -202,7 +201,6 @@ def unfoldConstAndprepReduceDefeq (unfolds : Array Prep.ConstUnfoldInfo) (lem :
let type := Prep.unfoldConsts unfolds type
let type ← Core.betaReduce (← instantiateMVars type)
let lem := {lem with type := type}
let lem ← lem.reorderForallInstDep
return lem

def traceLemmas (pre : String) (lemmas : Array Lemma) : TacticM Unit := do
Expand Down
5 changes: 4 additions & 1 deletion Auto/Translation/Assumptions.lean
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def Lemma.equivQuick (lem₁ lem₂ : Lemma) : MetaM Bool := do
let s₂₁ ← Lemma.subsumeQuick lem₂ lem₁
return s₁₂ && s₂₁

/-- Reorder top-level `∀` so that (non-prop / dependent) ones precede other ones -/
/- **TODO:** Determine whether this is useful -/
/- Reorder top-level `∀` so that (non-prop / dependent) ones precede other ones -/
/-
def Lemma.reorderForallInstDep (lem : Lemma) : MetaM Lemma := do
let depargs := HashSet.empty.insertMany (Expr.depArgs lem.type)
Meta.forallTelescope lem.type fun xs body => do
Expand All @@ -112,6 +114,7 @@ def Lemma.reorderForallInstDep (lem : Lemma) : MetaM Lemma := do
let proof ← Meta.mkLambdaFVars prec (← Meta.mkLambdaFVars trail proof)
let type ← Meta.mkForallFVars prec (← Meta.mkForallFVars trail body)
return ⟨⟨proof, type, lem.deriv⟩, lem.params⟩
-/

/--
Rewrite using a universe-monomorphic rigid equality
Expand Down
3 changes: 3 additions & 0 deletions Auto/Translation/Monomorphization.lean
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ initialize
registerTraceClass `auto.mono.printLemmaInst
registerTraceClass `auto.mono.printConstInst
registerTraceClass `auto.mono.printResult
registerTraceClass `auto.mono.printInputLemmas

register_option auto.mono.saturationThreshold : Nat := {
defValue := 250
Expand Down Expand Up @@ -903,6 +904,8 @@ def intromono (lemmas : Array Lemma) (mvarId : MVarId) : MetaM MVarId := do
return mvar.mvarId!)

def monomorphize (lemmas : Array Lemma) (inhFacts : Array Lemma) (k : Reif.State → MetaM α) : MetaM α := do
for h in lemmas do
trace[auto.mono.printInputLemmas] "Monomorphization got input lemma :: {h.type}"
let (inductiveVals, monoSt) ← monoMAction.run {}
MetaState.runWithIntroducedFVars (metaStateMAction inductiveVals monoSt) k
where
Expand Down
5 changes: 5 additions & 0 deletions Test/SmtTranslation/Trigger.lean
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ axiom fGreater : forall x, trigger (f x) (f x > x)

set_option trace.auto.lamFOL2SMT.nameSuggestion true
theorem fPlusOneGreater : forall x, (f x) + 1 > x := by auto [fGreater] u[]

axiom fTrueGreater : true → ∀ x, trigger (f x) (f x > x)

set_option trace.auto.printLemmas true
theorem fTrueGreaterTr : true → forall x, f x > x := by auto [fTrueGreater] u[]

0 comments on commit 91e5820

Please sign in to comment.