/-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov, Patrick Massot

! This file was ported from Lean 3 source module data.set.intervals.monoid
! leanprover-community/mathlib commit c3291da49cfa65f0d43b094750541c0731edc932
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Data.Set.Intervals.Basic
import Mathbin.Data.Set.Function
import Mathbin.Algebra.Order.Monoid.Cancel.Defs
import Mathbin.Algebra.Order.Monoid.Canonical.Defs
import Mathbin.Algebra.Group.Basic

/-!
# Images of intervals under `(+ d)`

> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.

The lemmas in this file state that addition maps intervals bijectively. The typeclass
`has_exists_add_of_le` is defined specifically to make them work when combined with
`ordered_cancel_add_comm_monoid`; the lemmas below therefore apply to all
`ordered_add_comm_group`, but also to `ℕ` and `ℝ≥0`, which are not groups.
-/

namespace Set

variable {M : Type _} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)

/- warning: set.Ici_add_bij -> Set.Ici_add_bij is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d))
Case conversion may be inaccurate. Consider using '#align set.Ici_add_bij Set.Ici_add_bijₓ'. -/
theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) :=
  by
  refine'
    ⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).InjOn _, fun _ h => _⟩
  obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h)
  rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
  exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ici_add_bij Set.Ici_add_bij

/- warning: set.Ioi_add_bij -> Set.Ioi_add_bij is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d))
Case conversion may be inaccurate. Consider using '#align set.Ioi_add_bij Set.Ioi_add_bijₓ'. -/
theorem Ioi_add_bij : BijOn (· + d) (Ioi a) (Ioi (a + d)) :=
  by
  refine'
    ⟨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h =>
      _⟩
  obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ioi.mp h).le
  rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h
  exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ioi_add_bij Set.Ioi_add_bij

/- warning: set.Icc_add_bij -> Set.Icc_add_bij is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
Case conversion may be inaccurate. Consider using '#align set.Icc_add_bij Set.Icc_add_bijₓ'. -/
theorem Icc_add_bij : BijOn (· + d) (Icc a b) (Icc (a + d) (b + d)) :=
  by
  rw [← Ici_inter_Iic, ← Ici_inter_Iic]
  exact
    (Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
      le_of_add_le_add_right hx.2
#align set.Icc_add_bij Set.Icc_add_bij

/- warning: set.Ioo_add_bij -> Set.Ioo_add_bij is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
Case conversion may be inaccurate. Consider using '#align set.Ioo_add_bij Set.Ioo_add_bijₓ'. -/
theorem Ioo_add_bij : BijOn (· + d) (Ioo a b) (Ioo (a + d) (b + d)) :=
  by
  rw [← Ioi_inter_Iio, ← Ioi_inter_Iio]
  exact
    (Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
      lt_of_add_lt_add_right hx.2
#align set.Ioo_add_bij Set.Ioo_add_bij

/- warning: set.Ioc_add_bij -> Set.Ioc_add_bij is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
Case conversion may be inaccurate. Consider using '#align set.Ioc_add_bij Set.Ioc_add_bijₓ'. -/
theorem Ioc_add_bij : BijOn (· + d) (Ioc a b) (Ioc (a + d) (b + d)) :=
  by
  rw [← Ioi_inter_Iic, ← Ioi_inter_Iic]
  exact
    (Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
      le_of_add_le_add_right hx.2
#align set.Ioc_add_bij Set.Ioc_add_bij

/- warning: set.Ico_add_bij -> Set.Ico_add_bij is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (d : M), Set.BijOn.{u1, u1} M M (fun (_x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) _x d) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) a b) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a d) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b d))
Case conversion may be inaccurate. Consider using '#align set.Ico_add_bij Set.Ico_add_bijₓ'. -/
theorem Ico_add_bij : BijOn (· + d) (Ico a b) (Ico (a + d) (b + d)) :=
  by
  rw [← Ici_inter_Iio, ← Ici_inter_Iio]
  exact
    (Ici_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
      lt_of_add_lt_add_right hx.2
#align set.Ico_add_bij Set.Ico_add_bij

/-!
### Images under `x ↦ x + a`
-/

/- warning: set.image_add_const_Ici -> Set.image_add_const_Ici is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a))
Case conversion may be inaccurate. Consider using '#align set.image_add_const_Ici Set.image_add_const_Iciₓ'. -/
@[simp]
theorem image_add_const_Ici : (fun x => x + a) '' Ici b = Ici (b + a) :=
  (Ici_add_bij _ _).image_eq
#align set.image_add_const_Ici Set.image_add_const_Ici

/- warning: set.image_add_const_Ioi -> Set.image_add_const_Ioi is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a))
Case conversion may be inaccurate. Consider using '#align set.image_add_const_Ioi Set.image_add_const_Ioiₓ'. -/
@[simp]
theorem image_add_const_Ioi : (fun x => x + a) '' Ioi b = Ioi (b + a) :=
  (Ioi_add_bij _ _).image_eq
#align set.image_add_const_Ioi Set.image_add_const_Ioi

/- warning: set.image_add_const_Icc -> Set.image_add_const_Icc is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
Case conversion may be inaccurate. Consider using '#align set.image_add_const_Icc Set.image_add_const_Iccₓ'. -/
@[simp]
theorem image_add_const_Icc : (fun x => x + a) '' Icc b c = Icc (b + a) (c + a) :=
  (Icc_add_bij _ _ _).image_eq
#align set.image_add_const_Icc Set.image_add_const_Icc

/- warning: set.image_add_const_Ico -> Set.image_add_const_Ico is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
Case conversion may be inaccurate. Consider using '#align set.image_add_const_Ico Set.image_add_const_Icoₓ'. -/
@[simp]
theorem image_add_const_Ico : (fun x => x + a) '' Ico b c = Ico (b + a) (c + a) :=
  (Ico_add_bij _ _ _).image_eq
#align set.image_add_const_Ico Set.image_add_const_Ico

/- warning: set.image_add_const_Ioc -> Set.image_add_const_Ioc is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
Case conversion may be inaccurate. Consider using '#align set.image_add_const_Ioc Set.image_add_const_Iocₓ'. -/
@[simp]
theorem image_add_const_Ioc : (fun x => x + a) '' Ioc b c = Ioc (b + a) (c + a) :=
  (Ioc_add_bij _ _ _).image_eq
#align set.image_add_const_Ioc Set.image_add_const_Ioc

/- warning: set.image_add_const_Ioo -> Set.image_add_const_Ioo is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) x a) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) b a) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) c a))
Case conversion may be inaccurate. Consider using '#align set.image_add_const_Ioo Set.image_add_const_Iooₓ'. -/
@[simp]
theorem image_add_const_Ioo : (fun x => x + a) '' Ioo b c = Ioo (b + a) (c + a) :=
  (Ioo_add_bij _ _ _).image_eq
#align set.image_add_const_Ioo Set.image_add_const_Ioo

/-!
### Images under `x ↦ a + x`
-/

/- warning: set.image_const_add_Ici -> Set.image_const_add_Ici is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ici.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b))
Case conversion may be inaccurate. Consider using '#align set.image_const_add_Ici Set.image_const_add_Iciₓ'. -/
@[simp]
theorem image_const_add_Ici : (fun x => a + x) '' Ici b = Ici (a + b) := by
  simp only [add_comm a, image_add_const_Ici]
#align set.image_const_add_Ici Set.image_const_add_Ici

/- warning: set.image_const_add_Ioi -> Set.image_const_add_Ioi is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b)) (Set.Ioi.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b))
Case conversion may be inaccurate. Consider using '#align set.image_const_add_Ioi Set.image_const_add_Ioiₓ'. -/
@[simp]
theorem image_const_add_Ioi : (fun x => a + x) '' Ioi b = Ioi (a + b) := by
  simp only [add_comm a, image_add_const_Ioi]
#align set.image_const_add_Ioi Set.image_const_add_Ioi

/- warning: set.image_const_add_Icc -> Set.image_const_add_Icc is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Icc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
Case conversion may be inaccurate. Consider using '#align set.image_const_add_Icc Set.image_const_add_Iccₓ'. -/
@[simp]
theorem image_const_add_Icc : (fun x => a + x) '' Icc b c = Icc (a + b) (a + c) := by
  simp only [add_comm a, image_add_const_Icc]
#align set.image_const_add_Icc Set.image_const_add_Icc

/- warning: set.image_const_add_Ico -> Set.image_const_add_Ico is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ico.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
Case conversion may be inaccurate. Consider using '#align set.image_const_add_Ico Set.image_const_add_Icoₓ'. -/
@[simp]
theorem image_const_add_Ico : (fun x => a + x) '' Ico b c = Ico (a + b) (a + c) := by
  simp only [add_comm a, image_add_const_Ico]
#align set.image_const_add_Ico Set.image_const_add_Ico

/- warning: set.image_const_add_Ioc -> Set.image_const_add_Ioc is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioc.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
Case conversion may be inaccurate. Consider using '#align set.image_const_add_Ioc Set.image_const_add_Iocₓ'. -/
@[simp]
theorem image_const_add_Ioc : (fun x => a + x) '' Ioc b c = Ioc (a + b) (a + c) := by
  simp only [add_comm a, image_add_const_Ioc]
#align set.image_const_add_Ioc Set.image_const_add_Ioc

/- warning: set.image_const_add_Ioo -> Set.image_const_add_Ioo is a dubious translation:
lean 3 declaration is
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toHasAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
but is expected to have type
  forall {M : Type.{u1}} [_inst_1 : OrderedCancelAddCommMonoid.{u1} M] [_inst_2 : ExistsAddOfLE.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1)))))) (Preorder.toLE.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)))] (a : M) (b : M) (c : M), Eq.{succ u1} (Set.{u1} M) (Set.image.{u1, u1} M M (fun (x : M) => HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a x) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) b c)) (Set.Ioo.{u1} M (PartialOrder.toPreorder.{u1} M (OrderedCancelAddCommMonoid.toPartialOrder.{u1} M _inst_1)) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a b) (HAdd.hAdd.{u1, u1, u1} M M M (instHAdd.{u1} M (AddZeroClass.toAdd.{u1} M (AddMonoid.toAddZeroClass.{u1} M (AddRightCancelMonoid.toAddMonoid.{u1} M (AddCancelMonoid.toAddRightCancelMonoid.{u1} M (AddCancelCommMonoid.toAddCancelMonoid.{u1} M (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} M _inst_1))))))) a c))
Case conversion may be inaccurate. Consider using '#align set.image_const_add_Ioo Set.image_const_add_Iooₓ'. -/
@[simp]
theorem image_const_add_Ioo : (fun x => a + x) '' Ioo b c = Ioo (a + b) (a + c) := by
  simp only [add_comm a, image_add_const_Ioo]
#align set.image_const_add_Ioo Set.image_const_add_Ioo

end Set


/-
Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import algebra.hom.group
import logic.equiv.basic
/-!
# Type tags that turn additive structures into multiplicative, and vice versa

We define two type tags:

* `additive α`: turns any multiplicative structure on `α` into the corresponding
  additive structure on `additive α`;
* `multiplicative α`: turns any additive structure on `α` into the corresponding
  multiplicative structure on `multiplicative α`.

We also define instances `additive.*` and `multiplicative.*` that actually transfer the structures.
-/

universes u v
variables {α : Type u} {β : Type v}

/-- If `α` carries some multiplicative structure, then `additive α` carries the corresponding
additive structure. -/
def additive (α : Type*) := α
/-- If `α` carries some additive structure, then `multiplicative α` carries the corresponding
multiplicative structure. -/
def multiplicative (α : Type*) := α

namespace additive

/-- Reinterpret `x : α` as an element of `additive α`. -/
def of_mul : α ≃ additive α := ⟨λ x, x, λ x, x, λ x, rfl, λ x, rfl⟩

/-- Reinterpret `x : additive α` as an element of `α`. -/
def to_mul : additive α ≃ α := of_mul.symm

@[simp] lemma of_mul_symm_eq : (@of_mul α).symm = to_mul := rfl

@[simp] lemma to_mul_symm_eq : (@to_mul α).symm = of_mul := rfl

end additive

namespace multiplicative

/-- Reinterpret `x : α` as an element of `multiplicative α`. -/
def of_add : α ≃ multiplicative α := ⟨λ x, x, λ x, x, λ x, rfl, λ x, rfl⟩

/-- Reinterpret `x : multiplicative α` as an element of `α`. -/
def to_add : multiplicative α ≃ α := of_add.symm

@[simp] lemma of_add_symm_eq : (@of_add α).symm = to_add := rfl

@[simp]

end multiplicative

@[simp] lemma to_add_of_add (x : α) : (multiplicative.of_add x).to_add = x := rfl
@[simp] lemma of_add_to_add (x : multiplicative α) : multiplicative.of_add x.to_add = x := rfl

@[simp] lemma to_mul_of_mul (x : α) : (additive.of_mul x).to_mul = x := rfl
@[simp] lemma of_mul_to_mul (x : additive α) : additive.of_mul x.to_mul = x := rfl

instance [inhabited α] : inhabited (additive α) := ⟨additive.of_mul default⟩
instance [inhabited α] : inhabited (multiplicative α) := ⟨multiplicative.of_add default⟩

instance [nontrivial α] : nontrivial (additive α) :=
additive.of_mul.injective.nontrivial

instance [nontrivial α] : nontrivial (multiplicative α) :=
multiplicative.of_add.injective.nontrivial

instance additive.has_add [has_mul α] : has_add (additive α) :=
{ add := λ x y, additive.of_mul (x.to_mul * y.to_mul) }

instance [has_add α] : has_mul (multiplicative α) :=
{ mul := λ x y, multiplicative.of_add (x.to_add + y.to_add) }

@[simp] lemma of_add_add [has_add α] (x y : α) :
  multiplicative.of_add (x + y) = multiplicative.of_add x * multiplicative.of_add y :=
rfl

@[simp] lemma to_add_mul [has_add α] (x y : multiplicative α) :
  (x * y).to_add = x.to_add + y.to_add :=
rfl

@[simp] lemma of_mul_mul [has_mul α] (x y : α) :
  additive.of_mul (x * y) = additive.of_mul x + additive.of_mul y :=
rfl

@[simp] lemma to_mul_add [has_mul α] (x y : additive α) :
  (x + y).to_mul = x.to_mul * y.to_mul :=
rfl

instance [semigroup α] : add_semigroup (additive α) :=
{ add_assoc := @mul_assoc α _,
  ..additive.has_add }

instance [add_semigroup α] : semigroup (multiplicative α) :=
{ mul_assoc := @add_assoc α _,
  ..multiplicative.has_mul }

instance [comm_semigroup α] : add_comm_semigroup (additive α) :=
{ add_comm := @mul_comm _ _,
  ..additive.add_semigroup }

instance [add_comm_semigroup α] : comm_semigroup (multiplicative α) :=
{ mul_comm := @add_comm _ _,
  ..multiplicative.semigroup }

instance [left_cancel_semigroup α] : add_left_cancel_semigroup (additive α) :=
{ add_left_cancel := @mul_left_cancel _ _,
  ..additive.add_semigroup }

instance [add_left_cancel_semigroup α] : left_cancel_semigroup (multiplicative α) :=
{ mul_left_cancel := @add_left_cancel _ _,
  ..multiplicative.semigroup }

instance [right_cancel_semigroup α] : add_right_cancel_semigroup (additive α) :=
{ add_right_cancel := @mul_right_cancel _ _,
  ..additive.add_semigroup }

instance [add_right_cancel_semigroup α] : right_cancel_semigroup (multiplicative α) :=
{ mul_right_cancel := @add_right_cancel _ _,
  ..multiplicative.semigroup }

instance [has_one α] : has_zero (additive α) := ⟨additive.of_mul 1⟩

@[simp] lemma of_mul_one [has_one α] : @additive.of_mul α 1 = 0 := rfl

@[simp] lemma of_mul_eq_zero {A : Type*} [has_one A] {x : A} :
  additive.of_mul x = 0 ↔ x = 1 := iff.rfl

@[simp] lemma to_mul_zero [has_one α] : (0 : additive α).to_mul = 1 := rfl

instance [has_zero α] : has_one (multiplicative α) := ⟨multiplicative.of_add 0⟩

@[simp] lemma of_add_zero [has_zero α] : @multiplicative.of_add α 0 = 1 := rfl

@[simp] lemma of_add_eq_one {A : Type*} [has_zero A] {x : A} :
  multiplicative.of_add x = 1 ↔ x = 0 := iff.rfl

@[simp] lemma to_add_one [has_zero α] : (1 : multiplicative α).to_add = 0 := rfl

instance [mul_one_class α] : add_zero_class (additive α) :=
{ zero     := 0,
  add      := (+),
  zero_add := one_mul,
  add_zero := mul_one }

instance [add_zero_class α] : mul_one_class (multiplicative α) :=
{ one     := 1,
  mul     := (*),
  one_mul := zero_add,
  mul_one := add_zero }

instance [h : monoid α] : add_monoid (additive α) :=
{ zero     := 0,
  add      := (+),
  nsmul    := @monoid.npow α h,
  nsmul_zero' := monoid.npow_zero',
  nsmul_succ' := monoid.npow_succ',
  ..additive.add_zero_class,
  ..additive.add_semigroup }

instance [h : add_monoid α] : monoid (multiplicative α) :=
{ one     := 1,
  mul     := (*),
  npow   := @add_monoid.nsmul α h,
  npow_zero' := add_monoid.nsmul_zero',
  npow_succ' := add_monoid.nsmul_succ',
  ..multiplicative.mul_one_class,
  ..multiplicative.semigroup }

instance [left_cancel_monoid α] : add_left_cancel_monoid (additive α) :=
{ zero := 0, add := (+), .. additive.add_monoid, .. additive.add_left_cancel_semigroup }

instance [add_left_cancel_monoid α] : left_cancel_monoid (multiplicative α) :=
{ one := 1, mul := (*), .. multiplicative.monoid, .. multiplicative.left_cancel_semigroup }

instance [right_cancel_monoid α] : add_right_cancel_monoid (additive α) :=
{ zero := 0, add := (+), .. additive.add_monoid, .. additive.add_right_cancel_semigroup }

instance [add_right_cancel_monoid α] : right_cancel_monoid (multiplicative α) :=
{ one := 1, mul := (*), .. multiplicative.monoid, .. multiplicative.right_cancel_semigroup }

instance [comm_monoid α] : add_comm_monoid (additive α) :=
{ zero := 0, add := (+), .. additive.add_monoid, .. additive.add_comm_semigroup }

instance [add_comm_monoid α] : comm_monoid (multiplicative α) :=
{ one := 1, mul := (*), ..multiplicative.monoid, .. multiplicative.comm_semigroup }

instance [has_inv α] : has_neg (additive α) := ⟨λ x, multiplicative.of_add x.to_mul⁻¹⟩

@[simp] lemma of_mul_inv [has_inv α] (x : α) : additive.of_mul x⁻¹ = -(additive.of_mul x) := rfl

@[simp] lemma to_mul_neg [has_inv α] (x : additive α) : (-x).to_mul = x.to_mul⁻¹ := rfl

instance [has_neg α] : has_inv (multiplicative α) := ⟨λ x, additive.of_mul (-x.to_add)⟩

@[simp] lemma of_add_neg [has_neg α] (x : α) :
  multiplicative.of_add (-x) = (multiplicative.of_add x)⁻¹ := rfl

@[simp] lemma to_add_inv [has_neg α] (x : multiplicative α) :
  (x⁻¹).to_add = -x.to_add := rfl

instance additive.has_sub [has_div α] : has_sub (additive α) :=
{ sub := λ x y, additive.of_mul (x.to_mul / y.to_mul) }

instance multiplicative.has_div [has_sub α] : has_div (multiplicative α) :=
{ div := λ x y, multiplicative.of_add (x.to_add - y.to_add) }

@[simp] lemma of_add_sub [has_sub α] (x y : α) :
  multiplicative.of_add (x - y) = multiplicative.of_add x / multiplicative.of_add y :=
rfl

@[simp] lemma to_add_div [has_sub α] (x y : multiplicative α) :
  (x / y).to_add = x.to_add - y.to_add :=
rfl

@[simp] lemma of_mul_div [has_div α] (x y : α) :
  additive.of_mul (x / y) = additive.of_mul x - additive.of_mul y :=
rfl

@[simp] lemma to_mul_sub [has_div α] (x y : additive α) :
  (x - y).to_mul = x.to_mul / y.to_mul :=
rfl

instance [div_inv_monoid α] : sub_neg_monoid (additive α) :=
{ sub_eq_add_neg := @div_eq_mul_inv α _,
  zsmul := @div_inv_monoid.zpow α _,
  zsmul_zero' := div_inv_monoid.zpow_zero',
  zsmul_succ' := div_inv_monoid.zpow_succ',
  zsmul_neg' := div_inv_monoid.zpow_neg',
  .. additive.has_neg, .. additive.has_sub, .. additive.add_monoid }

instance [sub_neg_monoid α] : div_inv_monoid (multiplicative α) :=
{ div_eq_mul_inv := @sub_eq_add_neg α _,
  zpow := @sub_neg_monoid.zsmul α _,
  zpow_zero' := sub_neg_monoid.zsmul_zero',
  zpow_succ' := sub_neg_monoid.zsmul_succ',
  zpow_neg' := sub_neg_monoid.zsmul_neg',
  .. multiplicative.has_inv, .. multiplicative.has_div, .. multiplicative.monoid }

instance [group α] : add_group (additive α) :=
{ add_left_neg := @mul_left_inv α _,
  .. additive.sub_neg_monoid }

instance [add_group α] : group (multiplicative α) :=
{ mul_left_inv := @add_left_neg α _,
  .. multiplicative.div_inv_monoid }

instance [comm_group α] : add_comm_group (additive α) :=
{ .. additive.add_group, .. additive.add_comm_monoid }

instance [add_comm_group α] : comm_group (multiplicative α) :=
{ .. multiplicative.group, .. multiplicative.comm_monoid }

/-- Reinterpret `α →+ β` as `multiplicative α →* multiplicative β`. -/
def add_monoid_hom.to_multiplicative [add_zero_class α] [add_zero_class β] :
  (α →+ β) ≃ (multiplicative α →* multiplicative β) :=
⟨λ f, ⟨f.1, f.2, f.3⟩, λ f, ⟨f.1, f.2, f.3⟩, λ x, by { ext, refl, }, λ x, by { ext, refl, }⟩

/-- Reinterpret `α →* β` as `additive α →+ additive β`. -/
def monoid_hom.to_additive [mul_one_class α] [mul_one_class β] :
  (α →* β) ≃ (additive α →+ additive β) :=
⟨λ f, ⟨f.1, f.2, f.3⟩, λ f, ⟨f.1, f.2, f.3⟩, λ x, by { ext, refl, }, λ x, by { ext, refl, }⟩

/-- Reinterpret `additive α →+ β` as `α →* multiplicative β`. -/
def add_monoid_hom.to_multiplicative' [mul_one_class α] [add_zero_class β] :
  (additive α →+ β) ≃ (α →* multiplicative β) :=
⟨λ f, ⟨f.1, f.2, f.3⟩, λ f, ⟨f.1, f.2, f.3⟩, λ x, by { ext, refl, }, λ x, by { ext, refl, }⟩

/-- Reinterpret `α →* multiplicative β` as `additive α →+ β`. -/
def monoid_hom.to_additive' [mul_one_class α] [add_zero_class β] :
  (α →* multiplicative β) ≃ (additive α →+ β) :=
add_monoid_hom.to_multiplicative'.symm

/-- Reinterpret `α →+ additive β` as `multiplicative α →* β`. -/
def add_monoid_hom.to_multiplicative'' [add_zero_class α] [mul_one_class β] :
  (α →+ additive β) ≃ (multiplicative α →* β) :=
⟨λ f, ⟨f.1, f.2, f.3⟩, λ f, ⟨f.1, f.2, f.3⟩, λ x, by { ext, refl, }, λ x, by { ext, refl, }⟩

/-- Reinterpret `multiplicative α →* β` as `α →+ additive β`. -/
def monoid_hom.to_additive'' [add_zero_class α] [mul_one_class β] :
  (multiplicative α →* β) ≃ (α →+ additive β) :=
add_monoid_hom.to_multiplicative''.symm

/-- If `α` has some multiplicative structure and coerces to a function,
then `additive α` should also coerce to the same function.

This allows `additive` to be used on bundled function types with a multiplicative structure, which
is often used for composition, without affecting the behavior of the function itself.
-/
instance additive.has_coe_to_fun {α : Type*} {β : α → Sort*} [has_coe_to_fun α β] :
  has_coe_to_fun (additive α) (λ a, β a.to_mul) :=
⟨λ a, coe_fn a.to_mul⟩

/-- If `α` has some additive structure and coerces to a function,
then `multiplicative α` should also coerce to the same function.

This allows `multiplicative` to be used on bundled function types with an additive structure, which
is often used for composition, without affecting the behavior of the function itself.
-/
instance multiplicative.has_coe_to_fun {α : Type*} {β : α → Sort*} [has_coe_to_fun α β] :
  has_coe_to_fun (multiplicative α) (λ a, β a.to_add) :=
⟨λ a, coe_fn a.to_add⟩


import topology.continuous_function.basic
import topology.instances.real
import topology.path_connected
import intervals

/-!
# Homotopy

In this file, we define homotopies between continuous functions. Note in particular that we are
defining homotopies to be `to_fun : C(X × ℝ, Y)` instead of `to_fun : C(X × I, Y)`. This is because
of the subtypes can be annoying to work with, and we don't actually care about the value that the
homotopy takes outside of `X × [0, 1]`.

## Implementation Notes

The definition of homotopies is inspired by the file HOL-Library/Homotopy, by Lawrence Paulson. In
particular, we define a general `homotopy_with f₀ f₁ P`, which is a homotopy between `f₀` and `f₁`,
where all of the intermediate maps satisfy the property `P`. In particular, this general definition
allows us to define homotopy, homotopy between paths, homotopy between loops and homotopy relative
to a subset all using the same definition.

## Key Declarations

- `homotopy_with f₀ f₁ P` - A homotopy between `f₀` and `f₁`, where all of the intermediate maps
  satisfy the property `P`.
- `homotopy f₀ f₁` - A homotopy between `f₀` and `f₁`.
-/

noncomputable theory

variables {X Y : Type _} [topological_space X] [topological_space Y]

/--
A homotopy between `f₀` and `f₁`, with a proposition `P` restricting the intermediate maps.
-/
@[nolint has_inhabited_instance] -- if `P` is always `false`, then there are no homotopies.
structure homotopy_with (f₀ f₁ : C(X, Y)) (P : (X → Y) → Prop) :=
(to_fun : C(X × ℝ, Y))
(to_fun_zero' : ∀ x, to_fun (x, 0) = f₀ x)
(to_fun_one' : ∀ x, to_fun (x, 1) = f₁ x)
(prop : ∀ t, P(λ x, to_fun (x, t)))

namespace homotopy_with

variables {f₀ f₁ f₂ : C(X, Y)} {P : (X → Y) → Prop}

instance : has_coe_t (homotopy_with f₀ f₁ P) (C(X × ℝ, Y)) := ⟨homotopy_with.to_fun⟩
instance : has_coe_to_fun (homotopy_with f₀ f₁ P) := ⟨_, λ h, h.to_fun.to_fun⟩

@[continuity]
lemma continuous (h : homotopy_with f₀ f₁ P) : continuous h := h.to_fun.continuous

@[simp] lemma to_fun_zero (h : homotopy_with f₀ f₁ P) (x : X) : h (x, 0) = f₀ x :=
  h.to_fun_zero' x

@[simp] lemma to_fun_one (h : homotopy_with f₀ f₁ P) (x : X) : h (x, 1) = f₁ x :=
  h.to_fun_one' x

@[simp] lemma coe_coe_apply_eq_coe (h : homotopy_with f₀ f₁ P) (x : X × ℝ) :
  (h : C(X × ℝ, Y)) x = h x := rfl

/--
If `f₀` satisfies the property `P`, then we have a `homotopy_with f₀ f₀ P`.
-/
def refl (hP : P f₀) : homotopy_with f₀ f₀ P :=
{ to_fun :=
  { to_fun := λ p, f₀ p.1 },
  to_fun_zero' := by simp only [continuous_map.coe_mk, implies_true_iff, eq_self_iff_true],
  to_fun_one' := by simp only [continuous_map.coe_mk, implies_true_iff, eq_self_iff_true],
  prop := λ t, hP }

/--
If `f₀` and `f₁` agree on every input, and that `f₀` satisfies the property `P`, then we have a ` homotmotopy_with f₀ f₁ P`.
-/
def of_refl (hP : P f₀) (h : f₀ = f₁) : homotopy_with f₀ f₁ P :=
{ to_fun := { to_fun := λ p, f₀ p.1 },
  to_fun_zero' := by simp only [continuous_map.coe_mk, implies_true_iff, eq_self_iff_true],
  to_fun_one' := by simp only [continuous_map.coe_mk, implies_true_iff, eq_self_iff_true, h],
  prop := λ t, hP }

/--
If we have `h : homotopy_with f₀ f₁ P`, we can define a `homotopy_with f₁ f₀ P` by reversing the
direction of the homotopy.
-/
def symm (h : homotopy_with f₀ f₁ P) : homotopy_with f₁ f₀ P :=
{ to_fun :=
  { to_fun := λ p, h (p.1, 1 - p.2) },
  to_fun_zero' := by simp,
  to_fun_one' := by simp,
  prop := λ t,
  begin
    simp only [continuous_map.coe_mk],
    apply h.prop,
  end }

/--
If we have `h₀ : homotopy_with f₀ f₁ P` and `h₁ : homotopy_with f₁ f₂ P`, we can define a
`homotopy_with f₀ f₂ P` by 'gluing' the homotopies together.
-/
def trans (h₀ : homotopy_with f₀ f₁ P) (h₁ : homotopy_with f₁ f₂ P) : homotopy_with f₀ f₂ P :=
{ to_fun :=
  { to_fun := λ p, if p.2 ≤ 1/2 then h₀ (p.1, 2 * p.2) else h₁ (p.1, 2 * p.2 - 1),
    continuous_to_fun := begin
      apply continuous.if; [skip, continuity, continuity],
      intros a ha,
      rw frontier_snd_le at ha,
      obtain ⟨ha₁, ha₂⟩ := ha,
      simp only [*, one_div, set.mem_singleton_iff, to_fun_one, mul_inv_cancel, ne.def,
                 not_false_iff, bit0_eq_zero, one_ne_zero, to_fun_zero, sub_self] at *,
    end },
  to_fun_zero' := λ x, by simp only [one_div, zero_le_one, inv_nonneg, if_true,
                                     continuous_map.coe_mk, zero_le_bit0, to_fun_zero, mul_zero],
  to_fun_one' := λ x, by norm_num,
  prop := λ t, begin
    simp only [continuous_map.coe_mk, set.mem_singleton_iff, to_fun_one, mul_inv_cancel,
               ne.def, not_false_iff, bit0_eq_zero, one_ne_zero, to_fun_zero, sub_self],
    split_ifs,
    { apply h₀.prop },
    { apply h₁.prop }
  end }

end homotopy_with

/--
A `homotopy f₀ f₁` is defined to be a `homotopy_with f₀ f₁ P`, where `P` is always `true`.
-/
abbreviation homotopy (f₀ f₁ : C(X, Y)) := homotopy_with f₀ f₁ (λ f, true)

namespace homotopy

variables {f₀ f₁ f₂ : C(X, Y)}

/--
For `homotopy f₀ f₀`, the property `P` in `homotopy_with.refl` is always satisfied, so we add in
this definition so we don't need to prove `true` every time.
-/
def refl (f₀ : C(X, Y)) : homotopy f₀ f₀ := homotopy_with.refl trivial

/--
The property `P` in `homotopy_with.refl` is always satisfied for `homotopy`, so we add in this
definition so we don't need to prove `true` every time.
-/
def of_refl (h : f₀ = f₁) : homotopy f₀ f₁ := homotopy_with.of_refl trivial h

end homotopy

/--
Two continuous functions `f₀` and `f₁` are homotopic if there exists a `homotopy f₀ f₁`.
-/
def homotopic (f₀ f₁ : C(X, Y)) := nonempty (homotopy f₀ f₁)

lemma homotopic.equiv : equivalence (@homotopic X Y _ _) :=
⟨λ f, ⟨homotopy.refl f⟩, λ f g ⟨h⟩, ⟨h.symm⟩, λ f₀ f₁ f₂ ⟨h₀⟩ ⟨h₁⟩, ⟨h₀.trans h₁⟩⟩