feat: add ExceptConds.and_elim_left/right (#12760)

This PR adds general projection lemmas for `ExceptConds` conjunction:

- `ExceptConds.and_elim_left`: `(x ∧ₑ y) ⊢ₑ x`
- `ExceptConds.and_elim_right`: `(x ∧ₑ y) ⊢ₑ y`

The existing `and_true`, `true_and`, `and_false`, `false_and` are
refactored as one-line corollaries.

Suggested by @sgraf812 in
https://github.com/leanprover-community/cslib/pull/376#discussion_r2066993469.

🤖 Prepared with Claude Code

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kim Morrison
2026-03-04 11:47:30 +11:00
committed by GitHub
parent 530925c69b
commit 0f7fb1ea4d

View File

@@ -210,41 +210,28 @@ theorem ExceptConds.fst_and {x₁ x₂ : ExceptConds (.except ε ps)} : (x₁
@[simp]
theorem ExceptConds.snd_and {x₁ x₂ : ExceptConds (.except ε ps)} : (x₁ x₂).snd = (x₁.snd x₂.snd) := rfl
@[simp]
theorem ExceptConds.and_true {x : ExceptConds ps} : x ExceptConds.true x := by
theorem ExceptConds.and_elim_left {ps : PostShape} (x y : ExceptConds ps) :
(x y) x := by
induction ps
case pure => trivial
case arg ih => exact ih
case except ε ps ih =>
simp_all only [true, and, const]
constructor <;> simp only [SPred.and_true.mp, implies_true, ih]
case arg ih => exact ih _ _
case except ε ps ih => exact fun _ => SPred.and_elim_l, ih _ _
@[simp]
theorem ExceptConds.true_and {x : ExceptConds ps} : ExceptConds.true x x := by
theorem ExceptConds.and_elim_right {ps : PostShape} (x y : ExceptConds ps) :
(x y) y := by
induction ps
case pure => trivial
case arg ih => exact ih
case except ε ps ih =>
simp_all only [true, and, const]
constructor <;> simp only [SPred.true_and.mp, implies_true, ih]
case arg ih => exact ih _ _
case except ε ps ih => exact fun _ => SPred.and_elim_r, ih _ _
@[simp]
theorem ExceptConds.and_false {x : ExceptConds ps} : x ExceptConds.false ExceptConds.false := by
induction ps
case pure => trivial
case arg ih => exact ih
case except ε ps ih =>
simp_all only [false, and, const]
constructor <;> simp only [SPred.and_false.mp, implies_true, ih]
@[simp]
theorem ExceptConds.false_and {x : ExceptConds ps} : ExceptConds.false x ExceptConds.false := by
induction ps
case pure => trivial
case arg ih => exact ih
case except ε ps ih =>
simp_all only [and, false, const]
constructor <;> simp only [SPred.false_and.mp, implies_true, ih]
@[simp] theorem ExceptConds.and_true {x : ExceptConds ps} : x ExceptConds.true x :=
and_elim_left _ _
@[simp] theorem ExceptConds.true_and {x : ExceptConds ps} : ExceptConds.true x x :=
and_elim_right _ _
@[simp] theorem ExceptConds.and_false {x : ExceptConds ps} : x ExceptConds.false ExceptConds.false :=
and_elim_right _ _
@[simp] theorem ExceptConds.false_and {x : ExceptConds ps} : ExceptConds.false x ExceptConds.false :=
and_elim_left _ _
theorem ExceptConds.and_eq_left {ps : PostShape} {p q : ExceptConds ps} (h : p q) :
p = (p q) := by