|
| 1 | +/-! |
| 2 | +# Regression test for issue 5925 |
| 3 | +https://github.com/leanprover/lean4/issues/5925 |
| 4 | +
|
| 5 | +This test was provided by @mik-jozef as an example that failed in v4.15.0-rc1 but is OK as of a nightly for 4.16. |
| 6 | +It is possible that this is the same issue as the one originally reported, but we have not checked. |
| 7 | +
|
| 8 | +A difficulty is that the original reported example does not typecheck due to other fixes (#6024). |
| 9 | +We ought to verify that https://github.com/leanprover/lean4/pull/6414 indeed is the reason that the test in this file passes. |
| 10 | +-/ |
| 11 | + |
| 12 | +def Set (D: Type) := D → Prop |
| 13 | + |
| 14 | +structure ValVar where |
| 15 | + d: Empty |
| 16 | + x: Nat |
| 17 | + |
| 18 | +structure Salgebra where |
| 19 | + D: Type |
| 20 | + I: Empty → Empty |
| 21 | + |
| 22 | +def pairSalgebra: Salgebra := ⟨Empty, nofun⟩ |
| 23 | + |
| 24 | +structure Cause (D: Type) where |
| 25 | + contextIns: Set Nat |
| 26 | + |
| 27 | +mutual |
| 28 | +inductive Ins (salg: Salgebra): Prop |
| 29 | + |
| 30 | +inductive IsCauseInapplicable (salg: Salgebra): |
| 31 | + Cause salg.D → Prop |
| 32 | + |
| 33 | +| blockedContextIns |
| 34 | + (cause: Cause salg.D) |
| 35 | + (inContextIns: cause.contextIns 0) |
| 36 | +: |
| 37 | + IsCauseInapplicable salg cause |
| 38 | +end |
| 39 | + |
| 40 | +def IsVarFree (x: Nat): Prop := ∀ d, ValVar.mk d x ∉ [] |
| 41 | + |
| 42 | +def extOfIntCause |
| 43 | + (internalCause: Cause Empty) |
| 44 | +: |
| 45 | + Cause Empty |
| 46 | +:= { |
| 47 | + contextIns := |
| 48 | + fun _ => ∃ vvI, internalCause.contextIns vvI ∧ IsVarFree vvI |
| 49 | +} |
| 50 | + |
| 51 | +def insInternalToInsExternal |
| 52 | + (isInapp: IsCauseInapplicable pairSalgebra internalCause) |
| 53 | +: |
| 54 | + IsCauseInapplicable pairSalgebra (extOfIntCause internalCause) |
| 55 | +:= |
| 56 | + isInapp.rec |
| 57 | + (motive_1 := fun _ => True) |
| 58 | + (motive_2 := |
| 59 | + fun cause _ => |
| 60 | + IsCauseInapplicable pairSalgebra (extOfIntCause cause)) |
| 61 | + (fun cause inCins => |
| 62 | + IsCauseInapplicable.blockedContextIns |
| 63 | + (salg := pairSalgebra) |
| 64 | + (extOfIntCause cause) |
| 65 | + (⟨_, inCins, nofun⟩)) |
0 commit comments