add(SetTheory): Recursion, ordinal addition and multiplication#799
add(SetTheory): Recursion, ordinal addition and multiplication#799tosiaki wants to merge 26 commits into
Conversation
…dFormalLogic#796) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SnO2WMaN <15155608+SnO2WMaN@users.noreply.github.com>
iehality
left a comment
There was a problem hiding this comment.
I added few comments. I haven't finished reviewing Recursion.lean yet, so I may add more comments later.
…ction-like relations
iehality
left a comment
There was a problem hiding this comment.
I added comments. Please request a review when you're done.
| have hpP : ⟨x, y⟩ₖ ∈ A ×ˢ range R := by simpa [mem_prod_iff] using ⟨hxA, hyR⟩ | ||
| simpa [restrict] using And.intro hpR hpP | ||
|
|
||
| lemma IsFunction.restrict (f A : V) [hf : IsFunction f] : IsFunction (f ↾ A) := by |
There was a problem hiding this comment.
This statement should be proved by a general proposition:
@[grind ->] lemma IsFunction.odSubset (f g : V) [hf : IsFunction f] : g ⊆ f → IsFunction gand
@[simp] lemma restrict_subset (f A : V) : f ↾ A ⊆ f|
Since all procedures defining transfinite recursion are similar, it might be good to create a suitable I did this for primitive recursive definitions while working on arithmetic. See this and its improvement for details. I defined a structure However, since this is somewhat technical, it can be postponed until you (we) actually tackle complicated theorems. |
…ing duplicate theorems, changing definability lemmas to instances, restating function membership and restrict lemmas
|
Is there currently any active work on making this PR ready for merge? If not, maybe I could help shorten proofs (I have heard most LLM-generated Lean proofs are about 10x longer than a concise human-written proof of the same theorem). However, if I do help, I would have to pause work on the Levy hierarchy. |
|
It would be helpful if you could work on it. The Levy hierarchy isn't an urgent issue, so I think it can be postponed. |
Fix credit
|
(I am still working on this. I currently have that the theorem |
Refactor Ordinal.lean Split ordinal arithmetic off into Ordinal/Arithmetic.lean Focus more on biconditional definition of `isAttemptGraph` rather than existential, while keeping the lemma that they are equivalent Prove that attempt functions exist via zero/successor/limit case specification
Since using |
You should use Classical.epsilon. noncomputable def attemptOrEmpty
(F : V → V) (α : V) : V := Classical.epsilon fun f ↦ "description of ExistsAttempt F α" |
|
Some more info about my progress: I've unfortunately made very little progress over the last month, I'm having trouble with rewriting the lemma |
|
I don't know if it's true that |
|
I think it is hard to make those functions definable. In Thus, making the output unique by returning |
|
@iehality This is an elegant way. However, unfortunately due to definability reasons I need to show that So instead of defining |
|
Besides dite, there is also the option to use Classical.byCases directly: noncomputable def attemptOrEmpty (F : V → V) (α : V) : V :=
Classical.byCases
(fun hα : ExistsAttempt F α => Classical.choose hα)
(fun _ => ∅) |
|
@tosiaki Thanks, I can try to get this to work. Currently it's not typechecking for me, saying that the value of Edit: I think I got it to typecheck by using the similar |
|
@Convindix right, my suggestion actually won't work because it returns Prop, not V. Perhaps the earlier suggestion to do something similar to subtraction makes the most sense. It doesn't require a large reorganization, just an additional small existence lemma on the "or default" conditional: /--
Choose a recursion-function graph at input `β` if one exists.
Otherwise, return an arbitrary value.
-/
lemma attemptOrEmpty_exists
(F : V → V) (β : V) :
∃ y : V,
(IsOrdinal β ∧ ExistsAttempt F β ∧ IsAttempt F β y) ∨
(¬(IsOrdinal β ∧ ExistsAttempt F β) ∧ y = ∅) := by
by_cases hβ : IsOrdinal β ∧ ExistsAttempt F β
· exact ⟨Classical.choose hβ.2, Or.inl ⟨hβ.1, hβ.2, Classical.choose_spec hβ.2⟩⟩
· exact ⟨∅, Or.inr ⟨hβ, rfl⟩⟩
noncomputable def attemptOrEmpty
(F : V → V) (β : V) : V :=
Classical.choose (attemptOrEmpty_exists F β)The spec and eq_iff theorems would just need minor adjustments: lemma attemptOrEmpty_spec_on
(F : V → V) (β : Ordinal V)
(hex : ExistsAttempt F β) :
IsAttemptOn F β (attemptOrEmpty F β.val) := by
have hchosen := Classical.choose_spec (attemptOrEmpty_exists F β.val)
rcases hchosen with ⟨_, _, hrec⟩ | ⟨hnex, _⟩
· simpa [attemptOrEmpty] using hrec
· exact (hnex ⟨β.ordinal, hex⟩).elim
lemma attemptOrEmpty_eq_iff
(F : V → V) (β y : V) :
y = attemptOrEmpty F β ↔
(IsOrdinal β ∧ ExistsAttempt F β ∧
IsAttempt F β y) ∨
(¬(IsOrdinal β ∧ ExistsAttempt F β) ∧
y = ∅) := by
constructor
· intro hy
rw [hy]
exact Classical.choose_spec (attemptOrEmpty_exists F β)
· rintro (⟨hord, hex, hrecf⟩ | ⟨hnex, rfl⟩)
· have hchosen := Classical.choose_spec (attemptOrEmpty_exists F β)
rcases hchosen with ⟨_, _, hrecg⟩ | ⟨hnex, _⟩
· letI : IsOrdinal β := hord
let βo : Ordinal V := IsOrdinal.toOrdinal β
exact isAttempt_unique_on (F := F) (α := βo)
(by simpa [βo] using hrecf) (by simpa [attemptOrEmpty, βo] using hrecg)
· exact (hnex ⟨hord, hex⟩).elim
· have hchosen := Classical.choose_spec (attemptOrEmpty_exists F β)
rcases hchosen with ⟨hord, hex, _⟩ | ⟨_, harb⟩
· exact (hnex ⟨hord, hex⟩).elim
· exact harb.symm |
|
@tosiaki Thank you. I haven't responded in a bit, but I currently believe I might be able to skip Also, maybe removing the zero/successor/limit case subdivision will make transfinite recursion in set theory more amenable to being generalized like the blueprints mentioned in this post? |
|
I'm now starting over with the new commits on FormalizedFormalLogic (e.g. Lean 4.31 version) and see lots of errors. I might post more on Zulip about the errors I'm getting, for example I guess that now the SetStructure is no longer |
Unless I'm missing something, the changes concerning
See https://github.com/FormalizedFormalLogic/Foundation/pull/794/changes for details. |
No description provided.