l3lab/ntp-mathlib huggingface dataset:
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  

Proof state:
f : Bool → Bool → Bool
x y n : ℕ
hx : x < 2 ^ n
hy : y < 2 ^ n
⊢ bitwise f x y < 2 ^ n

Next tactic:
induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      cases n <;> simp_all
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  

Proof state:
case z
f : Bool → Bool → Bool
y n : ℕ
hx : 0 < 2 ^ n
hy : y < 2 ^ n
⊢ bitwise f 0 y < 2 ^ n

Next tactic:
| z =>
    simp only [bitwise_zero_left]
    split <;> assumption
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    

Proof state:
case z
f : Bool → Bool → Bool
y n : ℕ
hx : 0 < 2 ^ n
hy : y < 2 ^ n
⊢ bitwise f 0 y < 2 ^ n

Next tactic:
simp only [bitwise_zero_left]
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    

Proof state:
case z
f : Bool → Bool → Bool
y n : ℕ
hx : 0 < 2 ^ n
hy : y < 2 ^ n
⊢ (if f false true = true then y else 0) < 2 ^ n

Next tactic:
split
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> 

Proof state:
case z.inl
f : Bool → Bool → Bool
y n : ℕ
hx : 0 < 2 ^ n
hy : y < 2 ^ n
h✝ : f false true = true
⊢ y < 2 ^ n

Next tactic:
assumption
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> 

Proof state:
case z.inr
f : Bool → Bool → Bool
y n : ℕ
hx : 0 < 2 ^ n
hy : y < 2 ^ n
h✝ : ¬f false true = true
⊢ 0 < 2 ^ n

Next tactic:
assumption
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  

Proof state:
case f
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
y n : ℕ
hx : bit bx nx < 2 ^ n
hy : y < 2 ^ n
⊢ bitwise f (bit bx nx) y < 2 ^ n

Next tactic:
| @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      cases n <;> simp_all
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    

Proof state:
case f
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
y n : ℕ
hx : bit bx nx < 2 ^ n
hy : y < 2 ^ n
⊢ bitwise f (bit bx nx) y < 2 ^ n

Next tactic:
cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      cases n <;> simp_all
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    

Proof state:
case f.z
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
hy : 0 < 2 ^ n
⊢ bitwise f (bit bx nx) 0 < 2 ^ n

Next tactic:
| z =>
      simp only [bitwise_zero_right]
      split <;> assumption
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      

Proof state:
case f.z
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
hy : 0 < 2 ^ n
⊢ bitwise f (bit bx nx) 0 < 2 ^ n

Next tactic:
simp only [bitwise_zero_right]
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      

Proof state:
case f.z
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
hy : 0 < 2 ^ n
⊢ (if f true false = true then bit bx nx else 0) < 2 ^ n

Next tactic:
split
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> 

Proof state:
case f.z.inl
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
hy : 0 < 2 ^ n
h✝ : f true false = true
⊢ bit bx nx < 2 ^ n

Next tactic:
assumption
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> 

Proof state:
case f.z.inr
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
hy : 0 < 2 ^ n
h✝ : ¬f true false = true
⊢ 0 < 2 ^ n

Next tactic:
assumption
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    

Proof state:
case f.f
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
by : Bool
ny : ℕ
hny : ny = 0 → by = true
hy : bit by ny < 2 ^ n
a✝ : bit by ny = ny → bitwise f (bit bx nx) (bit by ny) < 2 ^ n
⊢ bitwise f (bit bx nx) (bit by ny) < 2 ^ n

Next tactic:
| f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      cases n <;> simp_all
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      

Proof state:
case f.f
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
by : Bool
ny : ℕ
hny : ny = 0 → by = true
hy : bit by ny < 2 ^ n
a✝ : bit by ny = ny → bitwise f (bit bx nx) (bit by ny) < 2 ^ n
⊢ bitwise f (bit bx nx) (bit by ny) < 2 ^ n

Next tactic:
rw [bitwise_bit' _ _ _ _ hnx hny]
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      

Proof state:
case f.f
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
n : ℕ
hx : bit bx nx < 2 ^ n
by : Bool
ny : ℕ
hny : ny = 0 → by = true
hy : bit by ny < 2 ^ n
a✝ : bit by ny = ny → bitwise f (bit bx nx) (bit by ny) < 2 ^ n
⊢ bit (f bx by) (bitwise f nx ny) < 2 ^ n

Next tactic:
cases n
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      cases n <;> 

Proof state:
case f.f.zero
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
by : Bool
ny : ℕ
hny : ny = 0 → by = true
hx : bit bx nx < 2 ^ zero
hy : bit by ny < 2 ^ zero
a✝ : bit by ny = ny → bitwise f (bit bx nx) (bit by ny) < 2 ^ zero
⊢ bit (f bx by) (bitwise f nx ny) < 2 ^ zero

Next tactic:
simp_all
/-- If `x` and `y` fit within `n` bits, then the result of any bitwise operation on `x` and `y` also
fits within `n` bits -/
theorem bitwise_lt {f x y n} (hx : x < 2 ^ n) (hy : y < 2 ^ n) :
    bitwise f x y < 2 ^ n := by
  induction x using Nat.binaryRec' generalizing n y with
  | z =>
    simp only [bitwise_zero_left]
    split <;> assumption
  | @f bx nx hnx ih =>
    cases y using Nat.binaryRec' with
    | z =>
      simp only [bitwise_zero_right]
      split <;> assumption
    | f «by» ny hny =>
      rw [bitwise_bit' _ _ _ _ hnx hny]
      cases n <;> 

Proof state:
case f.f.succ
f : Bool → Bool → Bool
bx : Bool
nx : ℕ
hnx : nx = 0 → bx = true
ih : ∀ {y n : ℕ}, nx < 2 ^ n → y < 2 ^ n → bitwise f nx y < 2 ^ n
by : Bool
ny : ℕ
hny : ny = 0 → by = true
n✝ : ℕ
hx : bit bx nx < 2 ^ succ n✝
hy : bit by ny < 2 ^ succ n✝
a✝ : bit by ny = ny → bitwise f (bit bx nx) (bit by ny) < 2 ^ succ n✝
⊢ bit (f bx by) (bitwise f nx ny) < 2 ^ succ n✝

Next tactic:
simp_all
lemma shiftLeft_lt {x n m : ℕ} (h : x < 2 ^ n) : x <<< m < 2 ^ (n + m) := by
  

Proof state:
x n m : ℕ
h : x < 2 ^ n
⊢ x <<< m < 2 ^ (n + m)

Next tactic:
simp only [pow_add, shiftLeft_eq, mul_lt_mul_right (two_pow_pos _), h]
/-- Note that the LHS is the expression used within `Std.BitVec.append`, hence the name. -/
lemma append_lt {x y n m} (hx : x < 2 ^ n) (hy : y < 2 ^ m) : y <<< n ||| x < 2 ^ (n + m) := by
  

Proof state:
x y n m : ℕ
hx : x < 2 ^ n
hy : y < 2 ^ m
⊢ y <<< n ||| x < 2 ^ (n + m)

Next tactic:
apply bitwise_lt
/-- Note that the LHS is the expression used within `Std.BitVec.append`, hence the name. -/
lemma append_lt {x y n m} (hx : x < 2 ^ n) (hy : y < 2 ^ m) : y <<< n ||| x < 2 ^ (n + m) := by
  apply bitwise_lt
  · 

Proof state:
case hx
x y n m : ℕ
hx : x < 2 ^ n
hy : y < 2 ^ m
⊢ y <<< n < 2 ^ (n + m)

Next tactic:
rw [add_comm]
/-- Note that the LHS is the expression used within `Std.BitVec.append`, hence the name. -/
lemma append_lt {x y n m} (hx : x < 2 ^ n) (hy : y < 2 ^ m) : y <<< n ||| x < 2 ^ (n + m) := by
  apply bitwise_lt
  · rw [add_comm]; 

Proof state:
case hx
x y n m : ℕ
hx : x < 2 ^ n
hy : y < 2 ^ m
⊢ y <<< n < 2 ^ (m + n)

Next tactic:
apply shiftLeft_lt hy
/-- Note that the LHS is the expression used within `Std.BitVec.append`, hence the name. -/
lemma append_lt {x y n m} (hx : x < 2 ^ n) (hy : y < 2 ^ m) : y <<< n ||| x < 2 ^ (n + m) := by
  apply bitwise_lt
  · rw [add_comm]; apply shiftLeft_lt hy
  · 

Proof state:
case hy
x y n m : ℕ
hx : x < 2 ^ n
hy : y < 2 ^ m
⊢ x < 2 ^ (n + m)

Next tactic:
apply lt_of_lt_of_le hx <| pow_le_pow_right (le_succ _) (le_add_right _ _)
/-- UV-compression is injective on the elements it moves. See `UV.compress`. -/
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
    { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
  

Proof state:
α : Type u_1
inst✝ : GeneralizedBooleanAlgebra α
u v : α
⊢ Set.InjOn (fun x => (x ⊔ u) \ v) {x | Disjoint u x ∧ v ≤ x}

Next tactic:
rintro a ha b hb hab
/-- UV-compression is injective on the elements it moves. See `UV.compress`. -/
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
    { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
  rintro a ha b hb hab
  

Proof state:
α : Type u_1
inst✝ : GeneralizedBooleanAlgebra α
u v a : α
ha : a ∈ {x | Disjoint u x ∧ v ≤ x}
b : α
hb : b ∈ {x | Disjoint u x ∧ v ≤ x}
hab : (fun x => (x ⊔ u) \ v) a = (fun x => (x ⊔ u) \ v) b
⊢ a = b

Next tactic:
have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
    dsimp at hab
    rw [hab]
/-- UV-compression is injective on the elements it moves. See `UV.compress`. -/
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
    { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
  rintro a ha b hb hab
  have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
    

Proof state:
α : Type u_1
inst✝ : GeneralizedBooleanAlgebra α
u v a : α
ha : a ∈ {x | Disjoint u x ∧ v ≤ x}
b : α
hb : b ∈ {x | Disjoint u x ∧ v ≤ x}
hab : (fun x => (x ⊔ u) \ v) a = (fun x => (x ⊔ u) \ v) b
⊢ ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v

Next tactic:
dsimp at hab
/-- UV-compression is injective on the elements it moves. See `UV.compress`. -/
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
    { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
  rintro a ha b hb hab
  have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
    dsimp at hab
    

Proof state:
α : Type u_1
inst✝ : GeneralizedBooleanAlgebra α
u v a : α
ha : a ∈ {x | Disjoint u x ∧ v ≤ x}
b : α
hb : b ∈ {x | Disjoint u x ∧ v ≤ x}
hab : (a ⊔ u) \ v = (b ⊔ u) \ v
⊢ ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v

Next tactic:
rw [hab]
/-- UV-compression is injective on the elements it moves. See `UV.compress`. -/
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
    { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
  rintro a ha b hb hab
  have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
    dsimp at hab
    rw [hab]
  

Proof state:
α : Type u_1
inst✝ : GeneralizedBooleanAlgebra α
u v a : α
ha : a ∈ {x | Disjoint u x ∧ v ≤ x}
b : α
hb : b ∈ {x | Disjoint u x ∧ v ≤ x}
hab : (fun x => (x ⊔ u) \ v) a = (fun x => (x ⊔ u) \ v) b
h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v
⊢ a = b

Next tactic:
rwa [sdiff_sdiff_comm, ha.1.symm.sup_sdiff_cancel_right, sdiff_sdiff_comm,
    hb.1.symm.sup_sdiff_cancel_right, sdiff_sup_cancel ha.2, sdiff_sup_cancel hb.2] at h
theorem compress_of_disjoint_of_le' (hva : Disjoint v a) (hua : u ≤ a) :
    compress u v ((a ⊔ v) \ u) = a := by
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u v a b : α
hva : Disjoint v a
hua : u ≤ a
⊢ compress u v ((a ⊔ v) \ u) = a

Next tactic:
rw [compress_of_disjoint_of_le disjoint_sdiff_self_right
      (le_sdiff.2 ⟨(le_sup_right : v ≤ a ⊔ v), hva.mono_right hua⟩),
    sdiff_sup_cancel (le_sup_of_le_left hua), hva.symm.sup_sdiff_cancel_right]
@[simp]
theorem compress_self (u a : α) : compress u u a = a := by
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v a✝ b u a : α
⊢ compress u u a = a

Next tactic:
unfold compress
@[simp]
theorem compress_self (u a : α) : compress u u a = a := by
  unfold compress
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v a✝ b u a : α
⊢ (if Disjoint u a ∧ u ≤ a then (a ⊔ u) \ u else a) = a

Next tactic:
split_ifs with h
@[simp]
theorem compress_self (u a : α) : compress u u a = a := by
  unfold compress
  split_ifs with h
  · 

Proof state:
case pos
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v a✝ b u a : α
h : Disjoint u a ∧ u ≤ a
⊢ (a ⊔ u) \ u = a

Next tactic:
exact h.1.symm.sup_sdiff_cancel_right
@[simp]
theorem compress_self (u a : α) : compress u u a = a := by
  unfold compress
  split_ifs with h
  · exact h.1.symm.sup_sdiff_cancel_right
  · 

Proof state:
case neg
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v a✝ b u a : α
h : ¬(Disjoint u a ∧ u ≤ a)
⊢ a = a

Next tactic:
rfl
/-- An element can be compressed to any other element by removing/adding the differences. -/
@[simp]
theorem compress_sdiff_sdiff (a b : α) : compress (a \ b) (b \ a) b = a := by
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u v a✝ b✝ a b : α
⊢ compress (a \ b) (b \ a) b = a

Next tactic:
refine' (compress_of_disjoint_of_le disjoint_sdiff_self_left sdiff_le).trans _
/-- An element can be compressed to any other element by removing/adding the differences. -/
@[simp]
theorem compress_sdiff_sdiff (a b : α) : compress (a \ b) (b \ a) b = a := by
  refine' (compress_of_disjoint_of_le disjoint_sdiff_self_left sdiff_le).trans _
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u v a✝ b✝ a b : α
⊢ (b ⊔ a \ b) \ (b \ a) = a

Next tactic:
rw [sup_sdiff_self_right, sup_sdiff, disjoint_sdiff_self_right.sdiff_eq_left, sup_eq_right]
/-- An element can be compressed to any other element by removing/adding the differences. -/
@[simp]
theorem compress_sdiff_sdiff (a b : α) : compress (a \ b) (b \ a) b = a := by
  refine' (compress_of_disjoint_of_le disjoint_sdiff_self_left sdiff_le).trans _
  rw [sup_sdiff_self_right, sup_sdiff, disjoint_sdiff_self_right.sdiff_eq_left, sup_eq_right]
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u v a✝ b✝ a b : α
⊢ b \ (b \ a) ≤ a

Next tactic:
exact sdiff_sdiff_le
/-- Compressing an element is idempotent. -/
@[simp]
theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v✝ a✝ b u v a : α
⊢ compress u v (compress u v a) = compress u v a

Next tactic:
unfold compress
/-- Compressing an element is idempotent. -/
@[simp]
theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by
  unfold compress
  

Proof state:
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v✝ a✝ b u v a : α
⊢ (if
        Disjoint u (if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a) ∧
          v ≤ if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a then
      ((if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a) ⊔ u) \ v
    else if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a) =
    if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a

Next tactic:
split_ifs with h h'
/-- Compressing an element is idempotent. -/
@[simp]
theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by
  unfold compress
  split_ifs with h h'
  · 

Proof state:
case pos
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v✝ a✝ b u v a : α
h : Disjoint u a ∧ v ≤ a
h' : Disjoint u ((a ⊔ u) \ v) ∧ v ≤ (a ⊔ u) \ v
⊢ ((a ⊔ u) \ v ⊔ u) \ v = (a ⊔ u) \ v

Next tactic:
rw [le_sdiff_iff.1 h'.2, sdiff_bot, sdiff_bot, sup_assoc, sup_idem]
/-- Compressing an element is idempotent. -/
@[simp]
theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by
  unfold compress
  split_ifs with h h'
  · rw [le_sdiff_iff.1 h'.2, sdiff_bot, sdiff_bot, sup_assoc, sup_idem]
  · 

Proof state:
case neg
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v✝ a✝ b u v a : α
h : Disjoint u a ∧ v ≤ a
h' : ¬(Disjoint u ((a ⊔ u) \ v) ∧ v ≤ (a ⊔ u) \ v)
⊢ (a ⊔ u) \ v = (a ⊔ u) \ v

Next tactic:
rfl
/-- Compressing an element is idempotent. -/
@[simp]
theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by
  unfold compress
  split_ifs with h h'
  · rw [le_sdiff_iff.1 h'.2, sdiff_bot, sdiff_bot, sup_assoc, sup_idem]
  · rfl
  · 

Proof state:
case neg
α : Type u_1
inst✝² : GeneralizedBooleanAlgebra α
inst✝¹ : DecidableRel Disjoint
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u✝ v✝ a✝ b u v a : α
h : ¬(Disjoint u a ∧ v ≤ a)
⊢ a = a

Next tactic:
rfl
/-- UV-compression is injective on the sets that are not UV-compressed. -/
theorem compress_injOn : Set.InjOn (compress u v) ↑(s.filter (compress u v · ∉ s)) := by
  

Proof state:
α : Type u_1
inst✝³ : GeneralizedBooleanAlgebra α
inst✝² : DecidableRel Disjoint
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
s : Finset α
u v a b : α
inst✝ : DecidableEq α
⊢ Set.InjOn (compress u v) ↑(filter (fun x => compress u v x ∉ s) s)

Next tactic:
intro a ha b hb hab