Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Veir/IR/WellFormed.lean
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ attribute [grind →] RegionPtr.BlockChain.inBounds
structure Operation.WellFormed (op : Operation) (ctx : IRContext) (opPtr : OperationPtr) hop : Prop where
inBounds : Operation.FieldsInBounds opPtr ctx hop
result_index i (iInBounds : i < opPtr.getNumResults! ctx) : ((opPtr.getResult i).get! ctx).index = i
result_owner i (iInBounds : i < opPtr.getNumResults! ctx) :
((opPtr.getResult i).get! ctx).owner = opPtr
operand_owner i (iInBounds : i < opPtr.getNumOperands! ctx) : ((opPtr.getOpOperand i).get! ctx).owner = opPtr
blockOperand_owner i (iInBounds : i < opPtr.getNumSuccessors! ctx) : ((opPtr.getBlockOperand i).get! ctx).owner = opPtr
regions_unique i (iInBounds : i < opPtr.getNumRegions! ctx) j (jInBounds : j < opPtr.getNumRegions! ctx) :
Expand Down Expand Up @@ -729,6 +731,9 @@ theorem Operation.WellFormed_unchanged
(hSameResultIndex :
∀ i, i < opPtr.getNumResults ctx opPtrInBounds →
((opPtr.getResult i).get! ctx).index = ((opPtr.getResult i).get! ctx').index)
(hSameResultOwner :
∀ i, i < opPtr.getNumResults ctx opPtrInBounds →
((opPtr.getResult i).get! ctx).owner = ((opPtr.getResult i).get! ctx').owner)
(hSameRegionParents :
∀ (regionPtr : RegionPtr), regionPtr.InBounds ctx →
(regionPtr.get! ctx).parent = some opPtr →
Expand Down
2 changes: 1 addition & 1 deletion Veir/Rewriter/WellFormed/Builder/OpOperands.lean
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ theorem Rewriter.pushOperand_WellFormed (valuePtr : ValuePtr) (valuePtrInBounds
pushOperand_OperationPtr_get_next_mono, pushOperand_BlockPtr_get_lastOp_mono, pushOperand_BlockPtr_get_firstOp_mono]
case operations =>
intros opPtr' opPtrInBounds
have ⟨h₁, h₂, h₃, h₄, h₅, h₆⟩ := hOpWf.operations opPtr' (by grind)
have ⟨h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ := hOpWf.operations opPtr' (by grind)
constructor
case region_parent =>
intros region regionInBounds
Expand Down
5 changes: 3 additions & 2 deletions Veir/Rewriter/WellFormed/Builder/OpResults.lean
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ theorem Rewriter.pushResult_WellFormed (ctx: IRContext) (opPtr: OperationPtr)
(hop : opPtr.InBounds ctx) (hctx : IRContext.WellFormed ctx)
(hres : newResult.FieldsInBounds (opPtr.pushResult ctx newResult hop))
(hNoFirst : newResult.firstUse = none)
(hIndex : newResult.index = opPtr.getNumResults ctx) :
(hIndex : newResult.index = opPtr.getNumResults ctx)
(hOwner : newResult.owner = opPtr) :
(opPtr.pushResult ctx newResult hop).WellFormed := by
have ⟨h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈⟩ := hctx
constructor
Expand Down Expand Up @@ -43,7 +44,7 @@ theorem Rewriter.pushResult_WellFormed (ctx: IRContext) (opPtr: OperationPtr)
case operations =>
intros op hop
have : op.InBounds ctx := by grind
have ⟨ha, hb, hc, hd, he, hf⟩ := h₆ op this
have ⟨ha, hb, hc, hd, he, hf, hg⟩ := h₆ op this
constructor
-- TODO: Understand why grind fails here
case region_parent => intros; constructor <;> simp <;> grind
Expand Down
4 changes: 2 additions & 2 deletions Veir/Rewriter/WellFormed/Rewriter/Operation.lean
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ theorem Rewriter.insertOp?_WellFormed (ctx : IRContext) (hctx : ctx.WellFormed)
case operations =>
intros op hop
have : op.InBounds ctx := by grind
have ⟨ha, hb, hc, hd, he, hf⟩ := h₆ op this
have ⟨ha, hb, hc, hd, he, hf, hg⟩ := h₆ op this
apply Operation.WellFormed_unchanged (ctx := ctx) <;> grind
case blocks =>
intros bl hbl
Expand Down Expand Up @@ -159,7 +159,7 @@ theorem Rewriter.detachOp_WellFormed (ctx : IRContext) (wf : ctx.WellFormed)
case operations =>
intros op' hop'
have : op'.InBounds ctx := by grind
have ⟨ha, hb, hc, hd, he, hf⟩ := h₆ op' this
have ⟨ha, hb, hc, hd, he, hf, hg⟩ := h₆ op' this
apply Operation.WellFormed_unchanged (ctx := ctx) <;> grind
case blocks =>
intros bl hbl
Expand Down