import Statement import FormalConflictRange.SimpleClosedForm set_option linter.unusedVariables false set_option linter.unusedSimpArgs false set_option linter.unreachableTactic false set_option linter.unusedTactic false set_option linter.unnecessarySeqFocus false namespace Statement open FormalConflictRange def toRefSelector (s : Selector) : FormalConflictRange.Selector := { key := s.key, offset := s.offset } def toRefRead (r : RangeRead) : FormalConflictRange.RangeRead := { begin := toRefSelector r.begin, end_ := toRefSelector r.end_, limit := none, reverse := r.reverse } def toRefDB (db : DB) : FormalConflictRange.DB := { keys := db.keys, sorted := db.sorted } def toRefCR (cr : ConflictRange) : FormalConflictRange.ConflictRange := { begin := cr.begin, end_ := cr.end_ } def toRefRes (res : Result) : FormalConflictRange.Result := { keys := res.keys, more := res.more } def ofRefSelector (s : FormalConflictRange.Selector) : Selector := { key := s.key, offset := s.offset } def ofRefRead (r : FormalConflictRange.RangeRead) : RangeRead := { begin := ofRefSelector r.begin, end_ := ofRefSelector r.end_, reverse := r.reverse } def ofRefDB (db : FormalConflictRange.DB) : DB := { keys := db.keys, sorted := db.sorted } def ofRefCR (cr : FormalConflictRange.ConflictRange) : ConflictRange := { begin := cr.begin, end_ := cr.end_ } def ofRefRes (res : FormalConflictRange.Result) : Result := { keys := res.keys, more := res.more } @[simp] theorem toRefRead_begin (r : RangeRead) : (toRefRead r).begin = toRefSelector r.begin := rfl @[simp] theorem toRefRead_end (r : RangeRead) : (toRefRead r).end_ = toRefSelector r.end_ := rfl @[simp] theorem toRefRead_reverse (r : RangeRead) : (toRefRead r).reverse = r.reverse := rfl @[simp] theorem toRefRead_limit (r : RangeRead) : (toRefRead r).limit = none := rfl @[simp] theorem toRefSelector_key (s : Selector) : (toRefSelector s).key = s.key := rfl @[simp] theorem toRefSelector_offset (s : Selector) : (toRefSelector s).offset = s.offset := rfl @[simp] theorem toRefDB_keys (db : DB) : (toRefDB db).keys = db.keys := rfl @[simp] theorem toRefDB_sorted (db : DB) : (toRefDB db).sorted = db.sorted := rfl @[simp] theorem toRefRes_keys (res : Result) : (toRefRes res).keys = res.keys := rfl @[simp] theorem toRefRes_more (res : Result) : (toRefRes res).more = res.more := rfl @[simp] theorem toRefCR_begin (cr : ConflictRange) : (toRefCR cr).begin = cr.begin := rfl @[simp] theorem toRefCR_end (cr : ConflictRange) : (toRefCR cr).end_ = cr.end_ := rfl @[simp] theorem toRefCR_mk (a b : WithTop Key) : toRefCR (⟨a, b⟩ : ConflictRange) = (⟨a, b⟩ : FormalConflictRange.ConflictRange) := rfl @[simp] theorem toRefCR_ite {c : Prop} [Decidable c] (a b : ConflictRange) : toRefCR (if c then a else b) = (if c then toRefCR a else toRefCR b : FormalConflictRange.ConflictRange) := by split <;> rfl -- Rewrite reference-side structure literals back into translations of statement -- literals, so the per-definition bridge lemmas can fire on them. @[simp] theorem ofRefSelector_toRefSelector (s : Selector) : ofRefSelector (toRefSelector s) = s := rfl @[simp] theorem ofRefSelector_lit (k : WithTop Key) (o : Int) : ofRefSelector (⟨k, o⟩ : FormalConflictRange.Selector) = (⟨k, o⟩ : Selector) := rfl @[simp] theorem ofRefRes_lit (ks : List Key) (m : Bool) : ofRefRes (⟨ks, m⟩ : FormalConflictRange.Result) = (⟨ks, m⟩ : Result) := rfl @[simp] theorem ofRefCR_lit (a b : WithTop Key) : ofRefCR (⟨a, b⟩ : FormalConflictRange.ConflictRange) = (⟨a, b⟩ : ConflictRange) := rfl @[simp] theorem toRefRead_mk_lit (b e : FormalConflictRange.Selector) (rev : Bool) : (⟨b, e, none, rev⟩ : FormalConflictRange.RangeRead) = toRefRead (⟨ofRefSelector b, ofRefSelector e, rev⟩ : RangeRead) := rfl @[simp] theorem toRefRes_mk_lit (ks : List Key) (m : Bool) : (⟨ks, m⟩ : FormalConflictRange.Result) = toRefRes (⟨ks, m⟩ : Result) := rfl -- inverses @[simp] theorem ofRefCR_toRefCR (cr : ConflictRange) : ofRefCR (toRefCR cr) = cr := rfl @[simp] theorem toRefCR_ofRefCR (cr : FormalConflictRange.ConflictRange) : toRefCR (ofRefCR cr) = cr := rfl @[simp] theorem ofRefRes_toRefRes (res : Result) : ofRefRes (toRefRes res) = res := rfl @[simp] theorem toRefRes_ofRefRes (res : FormalConflictRange.Result) : toRefRes (ofRefRes res) = res := rfl @[simp] theorem ofRefDB_toRefDB (db : DB) : ofRefDB (toRefDB db) = db := rfl @[simp] theorem toRefDB_ofRefDB (db : FormalConflictRange.DB) : toRefDB (ofRefDB db) = db := rfl @[simp] theorem ofRefRead_toRefRead (r : RangeRead) : ofRefRead (toRefRead r) = r := rfl -- Alias lemmas for reference names that merely duplicate another reference -- definition (with identical bodies). @[simp] theorem ref_closedFormZeroCrossEndOne_eq (r : FormalConflictRange.RangeRead) (res : FormalConflictRange.Result) : FormalConflictRange.closedFormZeroCrossEndOne r res = FormalConflictRange.closedFormZeroCrossEndNonpos r res := rfl @[simp] theorem ref_compactReverseTruncatedZero_eq (r : FormalConflictRange.RangeRead) (res : FormalConflictRange.Result) : FormalConflictRange.compactReverseTruncatedZero r res = FormalConflictRange.closedFormOffsetOneTruncatedRevFullC r res := FormalConflictRange.compactReverseTruncatedZero_eq_offsetOne r res @[simp] theorem ite_or_same {c₁ c₂ : Prop} [Decidable c₁] [Decidable c₂] {α : Type} (a b : α) : (if c₁ then a else if c₂ then a else b) = if c₁ ∨ c₂ then a else b := by by_cases h₁ : c₁ <;> by_cases h₂ : c₂ <;> simp [h₁, h₂] @[simp] theorem normalizeCompleteResult_keys (r : RangeRead) (res : Result) : (Statement.normalizeCompleteResult r res).keys = (if r.reverse = true then res.keys.reverse else res.keys) := rfl theorem normalizeCompleteResult_keys_ne (r : RangeRead) (res : Result) (h : res.keys ≠ []) : (Statement.normalizeCompleteResult r res).keys ≠ [] := by unfold Statement.normalizeCompleteResult split <;> simp_all attribute [simp] normalizeCompleteResult_keys_ne @[simp] theorem tr_keyAfterN (n : ℕ) (k : Key) : FormalConflictRange.keyAfterN n k = Statement.keyAfterN n k := by induction n generalizing k with | zero => rfl | succ n ih => simp [FormalConflictRange.keyAfterN, Statement.keyAfterN, ih] <;> rfl -- SKIP (no reference) Selector.anchor -> Selector.anchor @[simp] theorem tr_resolve (db : DB) (s : Selector) : FormalConflictRange.resolve (toRefDB db) (toRefSelector s) = Statement.resolve (db) (s) := by unfold FormalConflictRange.resolve Statement.resolve simp only [toRefDB_keys] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) -- SKIP (no reference) RangeRead.inRange -> RangeRead.inRange -- SKIP (no reference) RangeRead.completeKeys -> RangeRead.completeKeys @[simp] theorem tr_keyAfter (k : Key) : FormalConflictRange.keyAfter (k) = Statement.keyAfter (k) := by unfold FormalConflictRange.keyAfter Statement.keyAfter simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_beginSlack (r : RangeRead) : FormalConflictRange.beginSlack (toRefRead r) = Statement.beginSlack (r) := by unfold FormalConflictRange.beginSlack Statement.beginSlack simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_cELo (oB : ℤ) (oE : ℤ) : FormalConflictRange.cELo (oB) (oE) = Statement.cELo (oB) (oE) := by unfold FormalConflictRange.cELo Statement.cELo simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_cEminP (_oB : ℤ) (oE : ℤ) : FormalConflictRange.cEminP (_oB) (oE) = Statement.cEminP (_oB) (oE) := by unfold FormalConflictRange.cEminP Statement.cEminP simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_canonicalRange (r : RangeRead) : FormalConflictRange.canonicalRange (toRefRead r) = toRefCR (Statement.canonicalRange (r)) := by unfold FormalConflictRange.canonicalRange Statement.canonicalRange simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_intervalCard (b : WithTop Key) (e : WithTop Key) : FormalConflictRange.intervalCard (b) (e) = Statement.intervalCard (b) (e) := by unfold FormalConflictRange.intervalCard Statement.intervalCard simp only [Fin.isValue, List.all_eq_true, beq_iff_eq, ENat.natCast_sub] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampCap (r : RangeRead) : FormalConflictRange.clampEndOneCap (toRefRead r) = Statement.clampCap (r) := by unfold FormalConflictRange.clampEndOneCap Statement.clampCap simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_overshoot (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.overshoot (toRefRead r) (toRefRes res) ↔ Statement.overshoot (r) (res) := by unfold FormalConflictRange.overshoot Statement.overshoot simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_reportedBelowBegin (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.reportedBelowBegin (toRefRead r) (toRefRes res) = Statement.reportedBelowBegin (r) (res) := by unfold FormalConflictRange.reportedBelowBegin Statement.reportedBelowBegin simp only [toRefRead_begin, toRefSelector_key, toRefRes_keys] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampSlack (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampEndOneSlack (toRefRead r) (toRefRes res) = Statement.clampSlack (r) (res) := by unfold FormalConflictRange.clampEndOneSlack Statement.clampSlack simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampEndOneUpper (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampEndOneUpper (toRefRead r) (toRefRes res) = Statement.clampEndOneUpper (r) (res) := by unfold FormalConflictRange.clampEndOneUpper Statement.clampEndOneUpper simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampHighCap (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampHighCap (toRefRead r) (toRefRes res) = Statement.clampHighCap (r) (res) := by unfold FormalConflictRange.clampHighCap Statement.clampHighCap simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampHighThresh (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampHighThresh (toRefRead r) (toRefRes res) = Statement.clampHighThresh (r) (res) := by unfold FormalConflictRange.clampHighThresh Statement.clampHighThresh simp only [toRefRead_end, toRefSelector_key, bottom] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampHighU (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampHighU (toRefRead r) (toRefRes res) = Statement.clampHighU (r) (res) := by unfold FormalConflictRange.clampHighU Statement.clampHighU simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampNonposD (r : RangeRead) : FormalConflictRange.clampNonposD (toRefRead r) = Statement.clampNonposD (r) := by unfold FormalConflictRange.clampNonposD Statement.clampNonposD simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampLongC (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampLongC (toRefRead r) (toRefRes res) = Statement.clampLongC (r) (res) := by unfold FormalConflictRange.clampLongC Statement.clampLongC simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampLongUpper (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampLongUpper (toRefRead r) (toRefRes res) = Statement.clampLongUpper (r) (res) := by unfold FormalConflictRange.clampLongUpper Statement.clampLongUpper simp only [ne_eq, hne, not_false_eq_true, tr_clampLongC, toRefRes_keys, List.headD_eq_head?_getD, toRefRead_end, toRefSelector_key, toRefRead_begin, first, firstKey, bottom, WithTop.coe_inj] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampNonposBottom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampNonposBottom (toRefRead r) (toRefRes res) ↔ Statement.clampNonposBottom (r) (res) := by unfold FormalConflictRange.clampNonposBottom Statement.clampNonposBottom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_leastReported (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.leastReported (toRefRead r) (toRefRes res) = Statement.leastReported (r) (res) := by unfold FormalConflictRange.leastReported Statement.leastReported simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampedNonpos (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampedNonpos (toRefRead r) (toRefRes res) ↔ Statement.clampedNonpos (r) (res) := by unfold FormalConflictRange.clampedNonpos Statement.clampedNonpos simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_clampsToBottom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.clampsToBottom (toRefRead r) (toRefRes res) ↔ Statement.clampsToBottom (r) (res) := by unfold FormalConflictRange.clampsToBottom Statement.clampsToBottom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_noPinB (KBE : ℕ∞) (oB : ℤ) (oE : ℤ) : FormalConflictRange.noPinB (KBE) (oB) (oE) = Statement.noPinB (KBE) (oB) (oE) := by unfold FormalConflictRange.noPinB Statement.noPinB simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossClampEndOne (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossClampEndOne (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossClampEndOne (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossClampEndOne Statement.closedFormNegCrossClampEndOne simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossClampEndOne (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossClampEndOne (toRefRead r) (toRefRes res) ↔ Statement.negCrossClampEndOne (r) (res) := by unfold FormalConflictRange.negCrossClampEndOne Statement.negCrossClampEndOne simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossHeadBottom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossHeadBottom (toRefRead r) (toRefRes res) ↔ Statement.negCrossHeadBottom (r) (res) := by unfold FormalConflictRange.negCrossHeadBottom Statement.negCrossHeadBottom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) private abbrev negCrossClampNonposInfiniteLegacy (r : RangeRead) (res : Result) : Prop := r.reverse = false ∧ r.begin.offset < 0 ∧ res.more = false ∧ r.end_.offset ≤ 0 ∧ r.begin.key ≤ r.end_.key ∧ intervalCard r.begin.key r.end_.key = ⊤ ∧ first res < r.begin.key ∧ reportedBelowBegin r res ≤ beginSlack r @[simp] private theorem tr_negCrossClampNonposInfiniteLegacy (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossClampNonposInfinite (toRefRead r) (toRefRes res) ↔ negCrossClampNonposInfiniteLegacy (r) (res) := by unfold FormalConflictRange.negCrossClampNonposInfinite negCrossClampNonposInfiniteLegacy simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossClampNonposLastGe (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossClampNonposLastGe (toRefRead r) (toRefRes res) ↔ Statement.negCrossClampNonposLastGe (r) (res) := by unfold FormalConflictRange.negCrossClampNonposLastGe Statement.negCrossClampNonposLastGe simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossClampNonposBottom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossClampNonposBottom (toRefRead r) (toRefRes res) ↔ Statement.negCrossClampNonposBottom (r) (res) := by unfold FormalConflictRange.negCrossClampNonposBottom Statement.negCrossClampNonposBottom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossClampLongNonpos (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossClampLongNonpos (toRefRead r) (toRefRes res) ↔ Statement.negCrossClampLongNonpos (r) (res) := by unfold FormalConflictRange.negCrossClampLongNonpos Statement.negCrossClampLongNonpos simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) theorem not_negCrossHeadBottom_of_negCrossClampLongNonpos (r : RangeRead) (res : Result) (hL : negCrossClampLongNonpos r res) : ¬ negCrossHeadBottom r res := by intro h unfold negCrossHeadBottom at h unfold negCrossClampLongNonpos at hL obtain ⟨_, _, _, _, hBE, _⟩ := h obtain ⟨_, _, _, _, _, _, _, hEB⟩ := hL exact (not_lt_of_ge hBE) hEB theorem not_negCrossClampNonposInfiniteLegacy_of_negCrossClampLongNonpos (r : RangeRead) (res : Result) (hL : negCrossClampLongNonpos r res) : ¬ negCrossClampNonposInfiniteLegacy r res := by intro h unfold negCrossClampNonposInfiniteLegacy at h unfold negCrossClampLongNonpos at hL obtain ⟨_, _, _, _, hBE, _, _, _⟩ := h obtain ⟨_, _, _, _, _, _, _, hEB⟩ := hL exact (not_lt_of_ge hBE) hEB theorem not_negCrossClampNonposBottom_of_negCrossClampLongNonpos (r : RangeRead) (res : Result) (hL : negCrossClampLongNonpos r res) : ¬ negCrossClampNonposBottom r res := by intro h unfold negCrossClampNonposBottom at h unfold negCrossClampLongNonpos at hL obtain ⟨_, _, _, _, hBE, _, _⟩ := h obtain ⟨_, _, _, _, _, _, _, hEB⟩ := hL exact (not_lt_of_ge hBE) hEB /-- The legacy priority-table shape of the clamping rule, matching the reference `closedFormNegCrossClampUnified`. It is kept as one shared expression so the bridge proof can rewrite to it before applying `closedFormNegCrossClampUnifiedLegacy_eq`. -/ private def closedFormNegCrossClampUnifiedLegacy (r : RangeRead) (res : Result) : ConflictRange := let end_ := if negCrossClampEndOne r res then clampEndOneUpper r res else if negCrossHeadBottom r res ∨ negCrossClampNonposInfiniteLegacy r res ∨ negCrossClampNonposLastGe r res ∨ negCrossClampNonposBottom r res then r.end_.key else if negCrossClampLongNonpos r res then clampLongUpper r res else r.end_.key range bottom end_ /-- The legacy clamped-unified rule can drop the three middle cases that simply return `r.end_.key`: each of them contradicts `negCrossClampLongNonpos` by the ordering of the two selector keys. `negCrossClampNonposLastGe` has no such key-order field, so it alone can overlap the long cell and remains as a guard. -/ private theorem closedFormNegCrossClampUnifiedLegacy_eq (r : RangeRead) (res : Result) : closedFormNegCrossClampUnifiedLegacy r res = closedFormNegCrossClampUnified r res := by unfold closedFormNegCrossClampUnifiedLegacy closedFormNegCrossClampUnified dsimp only by_cases hE : negCrossClampEndOne r res · rw [ite_eq_left hE, ite_eq_left hE] · by_cases hL : negCrossClampLongNonpos r res · have hB1 := not_negCrossHeadBottom_of_negCrossClampLongNonpos r res hL have hB2 := not_negCrossClampNonposInfiniteLegacy_of_negCrossClampLongNonpos r res hL have hB4 := not_negCrossClampNonposBottom_of_negCrossClampLongNonpos r res hL by_cases hB3 : negCrossClampNonposLastGe r res <;> simp [hE, hL, hB1, hB2, hB3, hB4] · simp [hE, hL] /-- The legacy shape is the reference shape, so this is the original bridge lemma. -/ private theorem tr_closedFormNegCrossClampUnifiedLegacy (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossClampUnified (toRefRead r) (toRefRes res) = toRefCR (closedFormNegCrossClampUnifiedLegacy r res) := by unfold FormalConflictRange.closedFormNegCrossClampUnified closedFormNegCrossClampUnifiedLegacy simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossClampUnified (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossClampUnified (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossClampUnified (r) (res)) := by rw [tr_closedFormNegCrossClampUnifiedLegacy r res hne] exact congrArg toRefCR (closedFormNegCrossClampUnifiedLegacy_eq r res) @[simp] theorem tr_negCrossCompleteHighM (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossCompleteHighM (toRefRead r) (toRefRes res) = Statement.negCrossCompleteHighM (r) (res) := by unfold FormalConflictRange.negCrossCompleteHighM Statement.negCrossCompleteHighM simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossHighD (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossHighD (toRefRead r) (toRefRes res) = Statement.negCrossHighD (r) (res) := by unfold FormalConflictRange.negCrossHighD Statement.negCrossHighD simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossHighGapCap (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossHighGapCap (toRefRead r) (toRefRes res) = Statement.negCrossHighGapCap (r) (res) := by unfold FormalConflictRange.negCrossHighGapCap Statement.negCrossHighGapCap simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossHighUsesEnd (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossHighUsesEnd (toRefRead r) (toRefRes res) ↔ Statement.negCrossHighUsesEnd (r) (res) := by unfold FormalConflictRange.negCrossHighUsesEnd Statement.negCrossHighUsesEnd simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossCompleteHigh (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossCompleteHigh (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossCompleteHigh (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossCompleteHigh Statement.closedFormNegCrossCompleteHigh simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossCompleteHigh (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossCompleteHigh (toRefRead r) (toRefRes res) ↔ Statement.negCrossCompleteHigh (r) (res) := by unfold FormalConflictRange.negCrossCompleteHigh Statement.negCrossCompleteHigh simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormDeficit (r : RangeRead) : FormalConflictRange.compactDeficit (toRefRead r) = Statement.closedFormDeficit (r) := by unfold FormalConflictRange.compactDeficit Statement.closedFormDeficit simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_completeResidualReduced (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.completeResidualReduced (toRefRead r) (toRefRes res) = toRefRead (Statement.completeResidualReduced (r) (res)) := by unfold FormalConflictRange.completeResidualReduced Statement.completeResidualReduced simp only [toRefRead_begin, toRefRes_keys, List.getLastD_eq_getLast?, tr_keyAfter, toRefRead_end, toRefSelector_offset, toRefRead_limit, toRefRead_reverse, toRefRead_mk_lit, ofRefSelector_toRefSelector, ofRefSelector_lit, afterLast, lastKey, residualT] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_topOfLast (last : Key) : FormalConflictRange.topOfLast (last) = toRefCR (Statement.topOfLast (last)) := by unfold FormalConflictRange.topOfLast Statement.topOfLast simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossOvershoot (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossOvershoot (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossOvershoot (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossOvershoot Statement.closedFormNegCrossOvershoot simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossEndOne (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossEndOne (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossEndOne (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossEndOne Statement.closedFormNegCrossEndOne simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossEndOneLong (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossEndOneLong (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossEndOneLong (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossEndOneLong Statement.closedFormNegCrossEndOneLong simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossCompleteResidual (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossCompleteResidual (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossCompleteResidual (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossCompleteResidual Statement.closedFormNegCrossCompleteResidual simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossCompleteHighResidual (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossCompleteHighResidual (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossCompleteHighResidual (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossCompleteHighResidual Statement.closedFormNegCrossCompleteHighResidual simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossNonclampUnified (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossNonclampUnified (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossNonclampUnified (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossNonclampUnified Statement.closedFormNegCrossNonclampUnified simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossTopUnified (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossTopUnified (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossTopUnified (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossTopUnified Statement.closedFormNegCrossTopUnified simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncNonposGap (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncNonposGap (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncNonposGap (r) (res) := by unfold FormalConflictRange.negCrossTruncNonposGap Statement.negCrossTruncNonposGap simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncNonposGapA2aBottom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncNonposGapA2aBottom (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncNonposGapA2aBottom (r) (res) := by unfold FormalConflictRange.negCrossTruncNonposGapA2aBottom Statement.negCrossTruncNonposGapA2aBottom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncNonposGapA2aBottomHigh (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncNonposGapA2aBottomHigh (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncNonposGapA2aBottomHigh (r) (res) := by unfold FormalConflictRange.negCrossTruncNonposGapA2aBottomHigh Statement.negCrossTruncNonposGapA2aBottomHigh simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossTruncNonposGapA2aBottom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossTruncNonposGapA2aBottom (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossTruncNonposGapA2aBottom (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossTruncNonposGapA2aBottom Statement.closedFormNegCrossTruncNonposGapA2aBottom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_finiteUnderCond (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.finiteUnderCond (toRefRead r) (toRefRes res) ↔ Statement.finiteUnderCond (r) (res) := by unfold FormalConflictRange.finiteUnderCond Statement.finiteUnderCond simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualFiniteOver (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualFiniteOver (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualFiniteOver (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualFiniteOver Statement.negCrossTruncRevResidualFiniteOver simp only [toRefRes_more, toRefRead_reverse, toRefRead_begin, toRefSelector_offset, toRefRes_keys, ne_eq, hne, not_false_eq_true, toRefRead_end, toRefSelector_key, List.getLastD_eq_getLast?, Int.pred_toNat, true_and, last, lastKey, residualT, residualE, and_congr_right_iff] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossTruncRevResidualFiniteUnified (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossTruncRevResidualFiniteUnified (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossTruncRevResidualFiniteUnified (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossTruncRevResidualFiniteUnified FormalConflictRange.closedFormNegCrossTruncRevResidualFiniteUnder Statement.closedFormNegCrossTruncRevResidualFiniteUnified simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_sentinelLargeTight (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.sentinelLargeTight (toRefRead r) (toRefRes res) ↔ Statement.sentinelLargeTight (r) (res) := by unfold FormalConflictRange.sentinelLargeTight Statement.sentinelLargeTight simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualTopLarge (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualTopLarge (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualTopLarge (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualTopLarge Statement.negCrossTruncRevResidualTopLarge simp only [toRefRes_more, toRefRead_reverse, toRefRead_begin, toRefSelector_offset, toRefRes_keys, ne_eq, hne, not_false_eq_true, toRefRead_end, toRefSelector_key, List.getLastD_eq_getLast?, Int.pred_toNat, ENat.natCast_sub, Nat.cast_one, tr_intervalCard, tsub_le_iff_right, true_and, last, lastKey, residualT, residualE, and_congr_right_iff, and_congr_left_iff] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualTopLargeSentinel (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualTopLargeSentinel (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualTopLargeSentinel (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualTopLargeSentinel Statement.negCrossTruncRevResidualTopLargeSentinel simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormNegCrossTruncRevResidualTopLargeUnified (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormNegCrossTruncRevResidualTopLargeUnified (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormNegCrossTruncRevResidualTopLargeUnified (r) (res)) := by unfold FormalConflictRange.closedFormNegCrossTruncRevResidualTopLargeUnified FormalConflictRange.closedFormNegCrossTruncRevResidualTopLargeSentinel Statement.closedFormNegCrossTruncRevResidualTopLargeUnified have hS := tr_negCrossTruncRevResidualTopLargeSentinel r res hne have hT := tr_sentinelLargeTight r res hne simp only [hS, hT, Statement.last] split_ifs <;> simp_all @[simp] theorem tr_truncatedRangeRev (r : RangeRead) (last : Key) : FormalConflictRange.truncatedRangeRev (toRefRead r) (last) = toRefCR (Statement.truncatedRangeRev (r) (last)) := by unfold FormalConflictRange.truncatedRangeRev Statement.truncatedRangeRev simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormReverseTruncatedZero (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOneTruncatedRevFullC (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormReverseTruncatedZero (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOneTruncatedRevFullC Statement.closedFormReverseTruncatedZero simp only [toRefRead_end, toRefSelector_offset, toRefRes_keys, List.getLastD_eq_getLast?, tr_truncatedRangeRev, toRefSelector_key, Int.pred_toNat, List.headD_eq_head?_getD, tr_keyAfter, tr_keyAfterN, lastKey, residualT, residualE, range, last, afterFirst, firstKey, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all only [not_le])) all_goals (try (split_ifs <;> simp_all only [not_le])) all_goals (try (split <;> simp_all only [ne_eq, toRefCR_ite, toRefCR_mk, FormalConflictRange.ConflictRange.mk.injEq, WithTop.coe_ne_top, WithTop.top_ne_coe, and_false])) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_truncatedRange (r : RangeRead) (last : Key) : FormalConflictRange.truncatedRange (toRefRead r) (last) = toRefCR (Statement.truncatedRange (r) (last)) := by unfold FormalConflictRange.truncatedRange Statement.truncatedRange simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_truncatedForwardClosed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.truncatedForwardClosed (toRefRead r) (toRefRes res) = toRefCR (Statement.truncatedForwardClosed (r) (res)) := by unfold FormalConflictRange.truncatedForwardClosed Statement.truncatedForwardClosed simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_gapOvershoot (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.gapOvershoot (toRefRead r) (toRefRes res) = Statement.gapOvershoot (r) (res) := by unfold FormalConflictRange.gapOvershoot Statement.gapOvershoot simp only [endOvershoot, toRefRead_end, toRefSelector_offset, Int.pred_toNat, reportedAtEnd, toRefSelector_key, toRefRes_keys, residualE, residualT] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_completeReversedClosed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.completeReversedClosed (toRefRead r) (toRefRes res) = toRefCR (Statement.completeReversedClosed (r) (res)) := by unfold FormalConflictRange.completeReversedClosed Statement.completeReversedClosed simp only [toRefRead_end, toRefSelector_offset, tr_canonicalRange, reportedAtEnd, toRefSelector_key, toRefRes_keys, endOvershoot, Int.pred_toNat, toRefRead_begin, ne_eq, hne, not_false_eq_true, tr_gapOvershoot, tr_intervalCard, List.headD_eq_head?_getD, tr_keyAfter, completeClosedWith, residualT, residualE, range, afterFirst, firstKey, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_completeForwardClosed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.completeForwardClosed (toRefRead r) (toRefRes res) = toRefCR (Statement.completeForwardClosed (r) (res)) := by unfold FormalConflictRange.completeForwardClosed Statement.completeForwardClosed simp only [toRefRead_end, toRefSelector_offset, tr_canonicalRange, reportedAtEnd, toRefSelector_key, toRefRes_keys, endOvershoot, Int.pred_toNat, toRefRead_begin, ne_eq, hne, not_false_eq_true, tr_gapOvershoot, tr_intervalCard, List.getLastD_eq_getLast?, tr_keyAfter, completeClosedWith, residualT, residualE, range, afterLast, lastKey, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_completeClosed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.completeClosed (toRefRead r) (toRefRes res) = toRefCR (Statement.completeClosed (r) (res)) := by unfold FormalConflictRange.completeClosed Statement.completeClosed simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormOffsetOneTruncated (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOneTruncated (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormOffsetOneTruncated (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOneTruncated Statement.closedFormOffsetOneTruncated simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_topRange (r : RangeRead) : FormalConflictRange.topRange (toRefRead r) = toRefCR (Statement.topRange (r)) := by unfold FormalConflictRange.topRange Statement.topRange simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormOffsetOneRev (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOneRev (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormOffsetOneRev (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOneRev Statement.closedFormOffsetOneRev simp only [toRefRead_end, toRefSelector_offset, tr_canonicalRange, toRefSelector_key, toRefRes_keys, Int.pred_toNat, List.headD_eq_head?_getD, tr_truncatedRange, tr_topRange, closedFormOffsetOneWith, residualT, residualE, firstKey, toRefCR_ite] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormOffsetOne (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOne (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormOffsetOne (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOne Statement.closedFormOffsetOne simp only [toRefRead_end, toRefSelector_offset, tr_canonicalRange, toRefSelector_key, toRefRes_keys, Int.pred_toNat, List.getLastD_eq_getLast?, tr_truncatedRange, tr_topRange, closedFormOffsetOneWith, residualT, residualE, lastKey, toRefCR_ite] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormOffsetOneAny (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOneAny (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormOffsetOneAny (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOneAny Statement.closedFormOffsetOneAny simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormOffsetOneUniversal (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOneUniversal (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormOffsetOneUniversal (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOneUniversal Statement.closedFormOffsetOneUniversal simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormOffsetOneTotal (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormOffsetOneTotal (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormOffsetOneTotal (r) (res)) := by unfold FormalConflictRange.closedFormOffsetOneTotal Statement.closedFormOffsetOneTotal simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossEndOneLong (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossEndOneLong (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossEndOneLong (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossEndOneLong Statement.closedFormZeroCrossEndOneLong simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossEnd (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossEndNonpos (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossEnd (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossEndNonpos Statement.closedFormZeroCrossEnd simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_crossedOvershootGeneral (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.crossedOvershootGeneral (toRefRead r) (toRefRes res) = Statement.crossedOvershootGeneral (r) (res) := by unfold FormalConflictRange.crossedOvershootGeneral Statement.crossedOvershootGeneral simp only [endOvershoot, toRefRead_end, toRefSelector_offset, Int.pred_toNat, reportedAtEnd, toRefSelector_key, toRefRes_keys, toRefRead_begin, residualE, residualT, residualB] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_completeForwardCrossedGeneral (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.completeForwardCrossedGeneral (toRefRead r) (toRefRes res) = toRefCR (Statement.completeForwardCrossedGeneral (r) (res)) := by unfold FormalConflictRange.completeForwardCrossedGeneral Statement.completeForwardCrossedGeneral simp only [toRefRead_end, toRefSelector_offset, tr_canonicalRange, reportedAtEnd, toRefSelector_key, toRefRes_keys, toRefRead_begin, Int.pred_toNat, endOvershoot, List.getLastD_eq_getLast?, tr_keyAfter, ne_eq, hne, not_false_eq_true, tr_crossedOvershootGeneral, tr_intervalCard, residualT, residualB, residualE, range, afterLast, lastKey, crossedBegin, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_zeroBeginAnchor (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroBeginAnchor (toRefRead r) (toRefRes res) = toRefRead (Statement.zeroBeginAnchor (r) (res)) := by unfold FormalConflictRange.zeroBeginAnchor Statement.zeroBeginAnchor simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_zeroCrossLongAnchor (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroCrossLongAnchor (toRefRead r) (toRefRes res) = toRefCR (Statement.zeroCrossLongAnchor (r) (res)) := by unfold FormalConflictRange.zeroCrossLongAnchor Statement.zeroCrossLongAnchor simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossLong (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossLong (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossLong (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossLong Statement.closedFormZeroCrossLong simp only [toRefRead_begin, toRefSelector_key, toRefRead_end, toRefRes_keys, List.headD_eq_head?_getD, toRefSelector_offset, Int.pred_toNat, ENat.natCast_sub, Nat.cast_one, tr_intervalCard, ne_eq, hne, not_false_eq_true, tr_zeroCrossLongAnchor, toRefCR_begin, toRefCR_end, range, first, firstKey, residualE, residualT, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossUnderEnd (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossUnderEnd (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossUnderEnd (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossUnderEnd Statement.closedFormZeroCrossUnderEnd simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossComplete (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossComplete (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossComplete (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossComplete Statement.closedFormZeroCrossComplete simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossCompleteRev (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossCompleteRev (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossCompleteRev (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossCompleteRev Statement.closedFormZeroCrossCompleteRev simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_zeroCrossUnderEnd (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroCrossUnderEnd (toRefRead r) (toRefRes res) ↔ Statement.zeroCrossUnderEnd (r) (res) := by unfold FormalConflictRange.zeroCrossUnderEnd Statement.zeroCrossUnderEnd simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossResidual (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossResidual (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossResidual (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossResidual Statement.closedFormZeroCrossResidual simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormZeroCrossTruncRevCrossed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.closedFormZeroCrossTruncRevCrossed (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormZeroCrossTruncRevCrossed (r) (res)) := by unfold FormalConflictRange.closedFormZeroCrossTruncRevCrossed Statement.closedFormZeroCrossTruncRevCrossed simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_AlwaysEmpty (r : RangeRead) : FormalConflictRange.AlwaysEmpty (toRefRead r) ↔ Statement.AlwaysEmpty (r) := by rw [FormalConflictRange.alwaysEmpty_iff_not_countFeasible, FormalConflictRange.countFeasible_iff_int, FormalConflictRange.countFeasibleInt_iff_closedForm] simp [FormalConflictRange.closedForm, Statement.AlwaysEmpty, Statement.bottom] @[simp] theorem tr_emptyRange (r : RangeRead) : FormalConflictRange.emptyRange (toRefRead r) = toRefCR (Statement.emptyRange (r)) := by unfold FormalConflictRange.emptyRange Statement.emptyRange simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_crossedRangeGeneral (r : RangeRead) : FormalConflictRange.crossedRangeGeneral (toRefRead r) = toRefCR (Statement.crossedRangeGeneral (r)) := by unfold FormalConflictRange.crossedRangeGeneral Statement.crossedRangeGeneral simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) private def emptyValueLegacy (r : RangeRead) : ConflictRange := if AlwaysEmpty r then emptyRange r else if r.begin.offset ≤ 0 then if 2 ≤ r.end_.offset then range bottom ⊤ else if r.begin.key ≤ r.end_.key then range bottom r.end_.key else if intervalCard r.end_.key r.begin.key < ↑(r.end_.offset - r.begin.offset).toNat then range bottom r.end_.key else range bottom (max r.begin.key r.end_.key) else if r.end_.offset ≤ 1 then canonicalRange r else if r.begin.key ≤ r.end_.key then topRange r else crossedRangeGeneral r /-- The explicit `begin.key ≤ end_.key` branch is redundant: when it holds, the capacity test below returns the same bottom-to-`end_.key` range on both sides, and when the capacity test fails the fallback's `max` is just `end_.key`. -/ private theorem emptyValueLegacy_eq (r : RangeRead) : emptyValueLegacy r = emptyValue r := by rw [emptyValueLegacy, emptyValue] by_cases hA : AlwaysEmpty r · rw [ite_eq_left hA, ite_eq_left hA] · rw [ite_eq_right hA, ite_eq_right hA] by_cases hb : r.begin.offset ≤ 0 · by_cases h2 : 2 ≤ r.end_.offset · simp [hb, h2] · by_cases hle : r.begin.key ≤ r.end_.key · by_cases hcap : intervalCard r.end_.key r.begin.key < ↑(r.end_.offset - r.begin.offset).toNat · simp [hb, h2, hle, hcap] · simp [hb, h2, hle, hcap, max_eq_right hle] · simp [hb, h2, hle] · simp [hb] private theorem tr_emptyValueLegacy (r : RangeRead) : FormalConflictRange.emptyValue (toRefRead r) = toRefCR (emptyValueLegacy r) := by unfold FormalConflictRange.emptyValue emptyValueLegacy simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_emptyValue (r : RangeRead) : FormalConflictRange.emptyValue (toRefRead r) = toRefCR (Statement.emptyValue (r)) := by rw [tr_emptyValueLegacy r] exact congrArg toRefCR (emptyValueLegacy_eq r) @[simp] theorem tr_closedFormBegin (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactBegin (toRefRead r) (toRefRes res) = Statement.closedFormBegin (r) (res) := by unfold FormalConflictRange.compactBegin Statement.closedFormBegin simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormFinite (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactFinite (toRefRead r) (toRefRes res) ↔ Statement.closedFormFinite (r) (res) := by unfold FormalConflictRange.compactFinite Statement.closedFormFinite simp only [tr_closedFormDeficit, FormalConflictRange.residualT, toRefRead_end, toRefSelector_key, toRefRes_keys, FormalConflictRange.residualE, toRefSelector_offset, Int.pred_toNat, residualT, residualE] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormCompleteForward (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactCompleteForward (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormCompleteForward (r) (res)) := by unfold FormalConflictRange.compactCompleteForward Statement.closedFormCompleteForward simp only [toRefRead_end, toRefSelector_offset, ne_eq, hne, not_false_eq_true, tr_closedFormBegin, toRefSelector_key, tr_clampsToBottom, toRefRead_begin, FormalConflictRange.residualT, toRefRes_keys, FormalConflictRange.residualE, Int.pred_toNat, List.getLastD_eq_getLast?, tr_keyAfter, tr_closedFormFinite, tr_crossedOvershootGeneral, tr_intervalCard, range, residualT, residualE, afterLast, lastKey, crossedBegin, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_normalizeCompleteResult (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.normalizeCompleteResult (toRefRead r) (toRefRes res) = toRefRes (Statement.normalizeCompleteResult (r) (res)) := by unfold FormalConflictRange.normalizeCompleteResult Statement.normalizeCompleteResult simp only [toRefRead_reverse, toRefRes_keys, toRefRes_mk_lit] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormComplete (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactComplete (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormComplete (r) (res)) := by unfold FormalConflictRange.compactComplete Statement.closedFormComplete have hne' : (Statement.normalizeCompleteResult r res).keys ≠ [] := normalizeCompleteResult_keys_ne r res hne exact tr_closedFormCompleteForward (Statement.forwardRead r) (Statement.normalizeCompleteResult r res) hne' @[simp] theorem tr_closedFormForwardCapacity (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactForwardCapacity (toRefRead r) (toRefRes res) = Statement.closedFormForwardCapacity (r) (res) := by unfold FormalConflictRange.compactForwardCapacity Statement.closedFormForwardCapacity simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormForwardTruncated (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactForwardTruncated (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormForwardTruncated (r) (res)) := by unfold FormalConflictRange.compactForwardTruncated Statement.closedFormForwardTruncated simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormReverseCount (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactReverseCount (toRefRead r) (toRefRes res) = Statement.closedFormReverseCount (r) (res) := by unfold FormalConflictRange.compactReverseCount Statement.closedFormReverseCount simp only [toRefRead_end, toRefSelector_key, toRefRead_begin, toRefRes_keys, FormalConflictRange.residualT, residualT] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormReverseFinite (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactReverseFinite (toRefRead r) (toRefRes res) ↔ Statement.closedFormReverseFinite (r) (res) := by unfold FormalConflictRange.compactReverseFinite Statement.closedFormReverseFinite simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormCrossedRoom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactCrossedRoom (toRefRead r) (toRefRes res) ↔ Statement.closedFormCrossedRoom (r) (res) := by unfold FormalConflictRange.compactCrossedRoom Statement.closedFormCrossedRoom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormReverseTruncatedSkip (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactReverseTruncatedSkip (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormReverseTruncatedSkip (r) (res)) := by unfold FormalConflictRange.compactReverseTruncatedSkip Statement.closedFormReverseTruncatedSkip simp only [toRefRead_end, toRefSelector_offset, tr_canonicalRange, toRefRes_keys, toRefSelector_key, tr_topRange, ne_eq, hne, not_false_eq_true, tr_closedFormReverseFinite, toRefRead_begin, List.headD_eq_head?_getD, tr_keyAfter, tr_closedFormCrossedRoom, ge_iff_le, residualE, Int.pred_toNat, ENat.natCast_sub, Nat.cast_one, last, lastKey, List.getLastD_eq_getLast?, tsub_le_iff_right, range, afterFirst, firstKey, toRefCR_ite, toRefCR_mk] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormReverseTruncated (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactReverseTruncated (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormReverseTruncated (r) (res)) := by unfold FormalConflictRange.compactReverseTruncated Statement.closedFormReverseTruncated simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormPositive (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactPositive (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormPositive (r) (res)) := by unfold FormalConflictRange.compactPositive Statement.closedFormPositive simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_zeroCrossOvershootComplete (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroCrossOvershootComplete (toRefRead r) (toRefRes res) ↔ Statement.zeroCrossOvershootComplete (r) (res) := by unfold FormalConflictRange.zeroCrossOvershootComplete Statement.zeroCrossOvershootComplete simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossOvershoot (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossOvershoot (toRefRead r) (toRefRes res) ↔ Statement.negCrossOvershoot (r) (res) := by unfold FormalConflictRange.negCrossOvershoot Statement.negCrossOvershoot unfold Statement.overshoot simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne, and_assoc] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_crossedCompleteOvershoot (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.crossedCompleteOvershoot (toRefRead r) (toRefRes res) ↔ Statement.crossedCompleteOvershoot (r) (res) := by unfold FormalConflictRange.crossedCompleteOvershoot Statement.crossedCompleteOvershoot simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_crossedCompleteEndLeOne (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.crossedCompleteEndLeOne (toRefRead r) (toRefRes res) ↔ Statement.crossedCompleteEndLeOne (r) (res) := by unfold FormalConflictRange.crossedCompleteEndLeOne Statement.crossedCompleteEndLeOne simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_zeroCrossLongTop (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroCrossLongTop (toRefRead r) (toRefRes res) ↔ Statement.zeroCrossLongTop (r) (res) := by unfold FormalConflictRange.zeroCrossLongTop Statement.zeroCrossLongTop simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_zeroCrossLongFinite (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroCrossLongFinite (toRefRead r) (toRefRes res) ↔ Statement.zeroCrossLongFinite (r) (res) := by unfold FormalConflictRange.zeroCrossLongFinite Statement.zeroCrossLongFinite simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_crossedCompleteBeginZero (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.crossedCompleteBeginZero (toRefRead r) (toRefRes res) ↔ Statement.crossedCompleteBeginZero (r) (res) := by unfold FormalConflictRange.crossedCompleteBeginZero Statement.crossedCompleteBeginZero simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) /-- The head-bottom, infinite and bottom predicates each imply `begin.key ≤ end_.key`, while the long nonpositive cell requires `end_.key < begin.key`. Hence the infinite cell is covered by either the earlier `crossedCompleteEndLeOne` branch or by the bottom cell. -/ private theorem infinite_subsumed_of_not_endLeOne (r : RangeRead) (res : Result) (hE : ¬ crossedCompleteEndLeOne r res) (h : negCrossClampNonposInfiniteLegacy r res) : negCrossClampNonposBottom r res := by unfold negCrossClampNonposInfiniteLegacy at h obtain ⟨hr, hb, hm, hend, hBE, _hcap, hfb, _hrep⟩ := h refine ⟨hr, hb, hm, hend, hBE, hfb, ?_⟩ by_contra hbot exact hE ⟨hr, hm, by omega, hfb, Or.inr ⟨hend, by rintro ⟨_, hb'⟩ exact hbot hb'⟩⟩ /-- The last-ge clamp cell is covered by the earlier end-le-one branch unless the bottom clamp holds; in that case `begin.key ≤ end_.key` gives the bottom cell and `end_.key < begin.key` gives the long nonpositive cell. -/ private theorem lastGe_subsumed_of_not_endLeOne (r : RangeRead) (res : Result) (hE : ¬ crossedCompleteEndLeOne r res) (h : negCrossClampNonposLastGe r res) : negCrossClampNonposBottom r res ∨ negCrossClampLongNonpos r res := by unfold negCrossClampNonposLastGe at h obtain ⟨hr, hb, hm, hend, hfb, _hlast, hrep⟩ := h have hbot : clampNonposBottom r res := by by_contra hbot exact hE ⟨hr, hm, by omega, hfb, Or.inr ⟨hend, by rintro ⟨_, hb'⟩ exact hbot hb'⟩⟩ by_cases hBE : r.begin.key ≤ r.end_.key · exact Or.inl ⟨hr, hb, hm, hend, hBE, hfb, hbot⟩ · exact Or.inr ⟨hr, hb, hm, hend, hfb, hrep, hbot, not_le.mp hBE⟩ /-- The legacy six-way clamping predicate used by the reference dispatcher. -/ private abbrev crossedCompleteClampLegacy (r : RangeRead) (res : Result) : Prop := negCrossClampEndOne r res ∨ negCrossHeadBottom r res ∨ negCrossClampNonposInfiniteLegacy r res ∨ negCrossClampNonposLastGe r res ∨ negCrossClampNonposBottom r res ∨ negCrossClampLongNonpos r res private theorem tr_crossedCompleteClampLegacy (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.crossedCompleteClamp (toRefRead r) (toRefRes res) ↔ crossedCompleteClampLegacy r res := by unfold FormalConflictRange.crossedCompleteClamp crossedCompleteClampLegacy simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) set_option synthInstance.maxSize 10000 in private def closedFormCrossedCompleteLegacy (r : RangeRead) (res : Result) : ConflictRange := if crossedCompleteOvershoot r res then closedFormNegCrossTopUnified r res else if crossedCompleteEndLeOne r res then closedFormNegCrossNonclampUnified r res else if crossedCompleteBeginZero r res then closedFormZeroCrossResidual r res else if crossedCompleteClampLegacy r res then closedFormNegCrossClampUnified r res else closedFormNegCrossCompleteHighResidual r res /-- Removing the two clamp cells covered by the earlier end-le-one branch does not change the crossed-complete dispatcher. -/ private theorem closedFormCrossedCompleteLegacy_eq (r : RangeRead) (res : Result) : closedFormCrossedCompleteLegacy r res = closedFormCrossedComplete r res := by unfold closedFormCrossedCompleteLegacy closedFormCrossedComplete by_cases hO : crossedCompleteOvershoot r res · rw [ite_eq_left hO, ite_eq_left hO] · rw [ite_eq_right hO, ite_eq_right hO] by_cases hE : crossedCompleteEndLeOne r res · rw [ite_eq_left hE, ite_eq_left hE] · rw [ite_eq_right hE, ite_eq_right hE] by_cases hB : crossedCompleteBeginZero r res · rw [ite_eq_left hB, ite_eq_left hB] · rw [ite_eq_right hB, ite_eq_right hB] have hclamp : crossedCompleteClampLegacy r res ↔ crossedCompleteClamp r res := by constructor · intro hL unfold crossedCompleteClampLegacy at hL unfold crossedCompleteClamp rcases hL with h | h | h | h | h | h · exact Or.inl h · exact Or.inr (Or.inl h) · exact Or.inr (Or.inr (Or.inl (infinite_subsumed_of_not_endLeOne r res hE h))) · rcases lastGe_subsumed_of_not_endLeOne r res hE h with h' | h' · exact Or.inr (Or.inr (Or.inl h')) · exact Or.inr (Or.inr (Or.inr h')) · exact Or.inr (Or.inr (Or.inl h)) · exact Or.inr (Or.inr (Or.inr h)) · intro hC unfold crossedCompleteClampLegacy unfold crossedCompleteClamp at hC rcases hC with h | h | h | h · exact Or.inl h · exact Or.inr (Or.inl h) · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl h)))) · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr h)))) by_cases hC : crossedCompleteClamp r res · have hCL : crossedCompleteClampLegacy r res := hclamp.mpr hC simp [hO, hE, hB, hC, hCL] · have hCL : ¬ crossedCompleteClampLegacy r res := fun h => hC (hclamp.mp h) simp [hO, hE, hB, hC, hCL] private theorem tr_closedFormCrossedCompleteLegacy (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactCrossedComplete (toRefRead r) (toRefRes res) = toRefCR (closedFormCrossedCompleteLegacy r res) := by unfold FormalConflictRange.compactCrossedComplete closedFormCrossedCompleteLegacy simp [tr_crossedCompleteClampLegacy r res hne, Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormCrossedComplete (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactCrossedComplete (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormCrossedComplete (r) (res)) := by rw [tr_closedFormCrossedCompleteLegacy r res hne] exact congrArg toRefCR (closedFormCrossedCompleteLegacy_eq r res) @[simp] theorem tr_zeroCrossTruncRevCrossed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.zeroCrossTruncRevCrossed (toRefRead r) (toRefRes res) ↔ Statement.zeroCrossTruncRevCrossed (r) (res) := by unfold FormalConflictRange.zeroCrossTruncRevCrossed Statement.zeroCrossTruncRevCrossed simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevUnder (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevUnder (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevUnder (r) (res) := by unfold FormalConflictRange.negCrossTruncRevUnder Statement.negCrossTruncRevUnder simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) private abbrev negCrossTruncRevCrossedNonposSmallLegacy (r : RangeRead) (res : Result) : Prop := res.more = true ∧ r.reverse = true ∧ r.begin.offset < 0 ∧ last res < r.begin.key ∧ r.end_.key < r.begin.key ∧ r.end_.offset ≤ 0 ∧ intervalCard r.end_.key r.begin.key + ↑res.keys.length + ↑(1 - r.end_.offset).toNat ≤ ↑(beginSlack r) + 1 private abbrev negCrossTruncRevCrossedSmallLegacy (r : RangeRead) (res : Result) : Prop := res.more = true ∧ r.reverse = true ∧ r.begin.offset < 0 ∧ last res < r.begin.key ∧ r.end_.key < r.begin.key ∧ r.end_.offset = 1 ∧ intervalCard r.end_.key r.begin.key + ↑res.keys.length ≤ ↑(beginSlack r) + 1 @[simp] private theorem tr_negCrossTruncRevCrossedNonposSmallLegacy (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevCrossedNonposSmall (toRefRead r) (toRefRes res) ↔ negCrossTruncRevCrossedNonposSmallLegacy (r) (res) := by unfold FormalConflictRange.negCrossTruncRevCrossedNonposSmall negCrossTruncRevCrossedNonposSmallLegacy simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] private theorem tr_negCrossTruncRevCrossedSmallLegacy (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevCrossedSmall (toRefRead r) (toRefRes res) ↔ negCrossTruncRevCrossedSmallLegacy (r) (res) := by unfold FormalConflictRange.negCrossTruncRevCrossedSmall negCrossTruncRevCrossedSmallLegacy simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) private theorem negCrossTruncRevCrossedLowLegacy_iff (r : RangeRead) (res : Result) : (negCrossTruncRevCrossedNonposSmallLegacy r res ∨ negCrossTruncRevCrossedSmallLegacy r res) ↔ negCrossTruncRevCrossedLow r res := by unfold negCrossTruncRevCrossedNonposSmallLegacy negCrossTruncRevCrossedSmallLegacy negCrossTruncRevCrossedLow constructor · rintro (⟨hm, hr, hb, hl, he, h0, hcap⟩ | ⟨hm, hr, hb, hl, he, h1, hcap⟩) · exact ⟨hm, hr, hb, hl, he, by omega, hcap⟩ · exact ⟨hm, hr, hb, hl, he, by omega, by simpa [h1] using hcap⟩ · rintro ⟨hm, hr, hb, hl, he, hle, hcap⟩ by_cases h0 : r.end_.offset ≤ 0 · exact Or.inl ⟨hm, hr, hb, hl, he, h0, hcap⟩ · have h1 : r.end_.offset = 1 := by omega exact Or.inr ⟨hm, hr, hb, hl, he, h1, by simpa [h1] using hcap⟩ @[simp] theorem tr_revTruncLeOneLow (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.revTruncLeOneLow (toRefRead r) (toRefRes res) ↔ Statement.revTruncLeOneLow (r) (res) := by unfold FormalConflictRange.revTruncLeOneLow Statement.revTruncLeOneLow simp [negCrossTruncRevCrossedLowLegacy_iff r res, Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevBelowEnd (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevBelowEnd (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevBelowEnd (r) (res) := by unfold FormalConflictRange.negCrossTruncRevBelowEnd Statement.negCrossTruncRevBelowEnd unfold Statement.overshoot simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne, and_assoc] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualRoom (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualRoom (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualRoom (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualRoom Statement.negCrossTruncRevResidualRoom simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualTopCrossedSmallGap (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualTopCrossedSmallGap (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualTopCrossedSmallGap (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualTopCrossedSmallGap Statement.negCrossTruncRevResidualTopCrossedSmallGap simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualTopCrossed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualTopCrossed (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualTopCrossed (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualTopCrossed Statement.negCrossTruncRevResidualTopCrossed simp only [toRefRes_more, toRefRead_reverse, toRefRead_begin, toRefSelector_offset, toRefRes_keys, ne_eq, hne, not_false_eq_true, toRefRead_end, List.getLastD_eq_getLast?, toRefSelector_key, Int.pred_toNat, true_and, last, lastKey, residualT, residualE, and_congr_right_iff] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_revTruncGeTwoTop (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.revTruncGeTwoTop (toRefRead r) (toRefRes res) ↔ Statement.revTruncGeTwoTop (r) (res) := by unfold FormalConflictRange.revTruncGeTwoTop Statement.revTruncGeTwoTop simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncRevResidualTopLargeCrossed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncRevResidualTopLargeCrossed (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncRevResidualTopLargeCrossed (r) (res) := by unfold FormalConflictRange.negCrossTruncRevResidualTopLargeCrossed Statement.negCrossTruncRevResidualTopLargeCrossed simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_revTruncGeTwoLarge (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.revTruncGeTwoLarge (toRefRead r) (toRefRes res) ↔ Statement.revTruncGeTwoLarge (r) (res) := by unfold FormalConflictRange.revTruncGeTwoLarge Statement.revTruncGeTwoLarge simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncTopTop (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncTopTop (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncTopTop (r) (res) := by unfold FormalConflictRange.negCrossTruncTopTop Statement.negCrossTruncTopTop simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_negCrossTruncTopTopEq (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.negCrossTruncTopTopEq (toRefRead r) (toRefRes res) ↔ Statement.negCrossTruncTopTopEq (r) (res) := by unfold FormalConflictRange.negCrossTruncTopTopEq Statement.negCrossTruncTopTopEq simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormClampSlack (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactClampSlack (toRefRead r) (toRefRes res) = Statement.closedFormClampSlack (r) (res) := by unfold FormalConflictRange.compactClampSlack Statement.closedFormClampSlack simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormClampGapSmall (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactClampGapSmall (toRefRead r) (toRefRes res) ↔ Statement.closedFormClampGapSmall (r) (res) := by unfold FormalConflictRange.compactClampGapSmall Statement.closedFormClampGapSmall simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormClampGapExactSaturated (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactClampGapExactSaturated (toRefRead r) (toRefRes res) ↔ Statement.closedFormClampGapExactSaturated (r) (res) := by unfold FormalConflictRange.compactClampGapExactSaturated Statement.closedFormClampGapExactSaturated simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormClampGapLow (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactClampGapLow (toRefRead r) (toRefRes res) ↔ Statement.closedFormClampGapLow (r) (res) := by unfold FormalConflictRange.compactClampGapLow Statement.closedFormClampGapLow simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormClampUpper (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactClampUpper (toRefRead r) (toRefRes res) = Statement.closedFormClampUpper (r) (res) := by unfold FormalConflictRange.compactClampUpper Statement.closedFormClampUpper simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormForwardSaturated (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactForwardSaturated (toRefRead r) (toRefRes res) ↔ Statement.closedFormForwardSaturated (r) (res) := by unfold FormalConflictRange.compactForwardSaturated Statement.closedFormForwardSaturated simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormForwardTruncatedNonpos (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactForwardTruncatedNonpos (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormForwardTruncatedNonpos (r) (res)) := by unfold FormalConflictRange.compactForwardTruncatedNonpos FormalConflictRange.closedFormNegCrossTruncTopTopEq Statement.closedFormForwardTruncatedNonpos simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) @[simp] theorem tr_closedFormCrossed (r : RangeRead) (res : Result) (hne : res.keys ≠ []) : FormalConflictRange.compactCrossed (toRefRead r) (toRefRes res) = toRefCR (Statement.closedFormCrossed (r) (res)) := by unfold FormalConflictRange.compactCrossed FormalConflictRange.closedFormNegCrossTruncRevUnder FormalConflictRange.closedFormNegCrossTruncRevCrossedNonposLarge FormalConflictRange.closedFormNegCrossTruncRevBelowEnd Statement.closedFormCrossed simp [Statement.firstKey, Statement.lastKey, Statement.first, Statement.last, Statement.afterFirst, Statement.afterLast, Statement.bottom, Statement.range, Statement.forwardRead, Statement.reversedResult, Statement.crossedBegin, Statement.completeClosedWith, Statement.closedFormOffsetOneWith, Statement.closedFormSplit, Statement.residualE, Statement.residualT, Statement.residualB, Statement.residualD, FormalConflictRange.compactSplit, FormalConflictRange.residualE, FormalConflictRange.residualT, FormalConflictRange.residualB, FormalConflictRange.residualD, FormalConflictRange.endOvershoot, FormalConflictRange.reportedAtEnd, hne] all_goals (try rfl) all_goals (try (intros; rfl)) all_goals (try (intros; exact Iff.rfl)) all_goals (try (intros; simp_all)) all_goals (try (split_ifs <;> simp_all)) all_goals (try (split <;> simp_all)) all_goals (try order) all_goals (try omega) all_goals (try contradiction) all_goals (try (exfalso; order)) all_goals (try (exfalso; omega)) all_goals (try rfl) end Statement