Skip to content

Commit

Permalink
tweak algorithm so we can build mem_omega state correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
bollu committed Oct 10, 2024
1 parent 78e4d64 commit d7ebfc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Arm/Memory/Common.lean
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ inductive Hypothesis
| pairwiseSeparate (proof : MemPairwiseSeparateProof e)
| read_eq (proof : ReadBytesEqProof)

def Hypothesis.isPairwiseSeparate : Hypothesis → Bool
| .pairwiseSeparate _ => true
| _ => false

def Hypothesis.proof : Hypothesis → Expr
| .pairwiseSeparate proof => proof.h
Expand Down
9 changes: 8 additions & 1 deletion Arm/Memory/MemOmega.lean
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,17 @@ def memOmegaTac : MemOmegaM Unit := do
for h in rawHyps do
hyps ← hypothesisOfExpr h hyps

-- used specialized procedure that doesn't unfold everything for the easy case.
if ← closeMemSideCondition (← getMainGoal) (← readThe Context).bvToNatSimpCtx (← readThe Context).bvToNatSimprocs hyps then
return ()
else
let _ ← Hypothesis.addOmegaFactsOfHyps hyps.toList #[]
let pairwise? := (← readThe Context).cfg.explodePairwiseSeparate
-- in the bad case, just rip through everything.
-- let _ ← Hypothesis.addOmegaFactsOfHyps (hyps.toList.filter (fun h => h.isPairwiseSeparate)) #[]
let _ ← Hypothesis.addOmegaFactsOfHyps
(hyps.toList.filter (!pairwise? || ·.isPairwiseSeparate))
#[]

TacticM.withTraceNode' m!"Reducion to omega" do
try
TacticM.traceLargeMsg m!"goal (Note: can be large)" m!"{← getMainGoal}"
Expand Down

0 comments on commit d7ebfc2

Please sign in to comment.