Skip to content

Commit 645422a

Browse files
kim-emclaude
andcommitted
feat(Std.Do): add ExceptConds.and_elim_left/right
Add general projection lemmas for ExceptConds conjunction, and refactor and_true/true_and/and_false/false_and as corollaries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cda8470 commit 645422a

File tree

1 file changed

+17
-30
lines changed

1 file changed

+17
-30
lines changed

src/Std/Do/PostCond.lean

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -210,41 +210,28 @@ theorem ExceptConds.fst_and {x₁ x₂ : ExceptConds (.except ε ps)} : (x₁
210210
@[simp]
211211
theorem ExceptConds.snd_and {x₁ x₂ : ExceptConds (.except ε ps)} : (x₁ ∧ₑ x₂).snd = (x₁.snd ∧ₑ x₂.snd) := rfl
212212

213-
@[simp]
214-
theorem ExceptConds.and_true {x : ExceptConds ps} : x ∧ₑ ExceptConds.true ⊢ₑ x := by
215-
induction ps
216-
case pure => trivial
217-
case arg ih => exact ih
218-
case except ε ps ih =>
219-
simp_all only [true, and, const]
220-
constructor <;> simp only [SPred.and_true.mp, implies_true, ih]
221-
222-
@[simp]
223-
theorem ExceptConds.true_and {x : ExceptConds ps} : ExceptConds.true ∧ₑ x ⊢ₑ x := by
224-
induction ps
225-
case pure => trivial
226-
case arg ih => exact ih
227-
case except ε ps ih =>
228-
simp_all only [true, and, const]
229-
constructor <;> simp only [SPred.true_and.mp, implies_true, ih]
230-
231-
@[simp]
232-
theorem ExceptConds.and_false {x : ExceptConds ps} : x ∧ₑ ExceptConds.false ⊢ₑ ExceptConds.false := by
213+
theorem ExceptConds.and_elim_left {ps : PostShape} (x y : ExceptConds ps) :
214+
(x ∧ₑ y) ⊢ₑ x := by
233215
induction ps
234216
case pure => trivial
235-
case arg ih => exact ih
236-
case except ε ps ih =>
237-
simp_all only [false, and, const]
238-
constructor <;> simp only [SPred.and_false.mp, implies_true, ih]
217+
case arg ih => exact ih _ _
218+
case except ε ps ih => exact ⟨fun _ => SPred.and_elim_l, ih _ _⟩
239219

240-
@[simp]
241-
theorem ExceptConds.false_and {x : ExceptConds ps} : ExceptConds.false ∧ₑ x ⊢ₑ ExceptConds.false := by
220+
theorem ExceptConds.and_elim_right {ps : PostShape} (x y : ExceptConds ps) :
221+
(x ∧ₑ y) ⊢ₑ y := by
242222
induction ps
243223
case pure => trivial
244-
case arg ih => exact ih
245-
case except ε ps ih =>
246-
simp_all only [and, false, const]
247-
constructor <;> simp only [SPred.false_and.mp, implies_true, ih]
224+
case arg ih => exact ih _ _
225+
case except ε ps ih => exact ⟨fun _ => SPred.and_elim_r, ih _ _⟩
226+
227+
@[simp] theorem ExceptConds.and_true {x : ExceptConds ps} : x ∧ₑ ExceptConds.true ⊢ₑ x :=
228+
and_elim_left _ _
229+
@[simp] theorem ExceptConds.true_and {x : ExceptConds ps} : ExceptConds.true ∧ₑ x ⊢ₑ x :=
230+
and_elim_right _ _
231+
@[simp] theorem ExceptConds.and_false {x : ExceptConds ps} : x ∧ₑ ExceptConds.false ⊢ₑ ExceptConds.false :=
232+
and_elim_right _ _
233+
@[simp] theorem ExceptConds.false_and {x : ExceptConds ps} : ExceptConds.false ∧ₑ x ⊢ₑ ExceptConds.false :=
234+
and_elim_left _ _
248235

249236
theorem ExceptConds.and_eq_left {ps : PostShape} {p q : ExceptConds ps} (h : p ⊢ₑ q) :
250237
p = (p ∧ₑ q) := by

0 commit comments

Comments
 (0)