Skip to content

Comments

Add n-ary equivalence URMComputable ↔ Nat.Partrec'#57

Merged
jessealama merged 4 commits intomainfrom
feature/partrec-prime-equivalence
Jan 21, 2026
Merged

Add n-ary equivalence URMComputable ↔ Nat.Partrec'#57
jessealama merged 4 commits intomainfrom
feature/partrec-prime-equivalence

Conversation

@jessealama
Copy link
Owner

No description provided.

jessealama and others added 4 commits January 20, 2026 22:43
Implement equivalence between n-ary URM computability and Mathlib's
n-ary partial recursive functions (Nat.Partrec').

New file Urm/PartrecPrime.lean:
- Type conversion utilities (toVectorFun, fromVectorFun)
- Vector encoding is URMComputable (encodeVector_computable)
- Backward direction complete (Nat.Partrec'.toURMComputable)
- Forward direction structure (URMComputable.toPartrec') with one sorry
- Main equivalence theorem (URMComputable_iff_Partrec')

Also adds Part.sequence_some lemma to PartSequence.lean.
Complete the proof of URMComputable n ↔ Nat.Partrec' by filling three sorries:

- URMComputable_zero_to_one: Lift 0-arity computable functions to 1-arity
  by prepending Z 0 to reset R₀. Added helper lemmas for step translation
  between concatenated and base programs.

- decode_valid_extract: Core encoding correspondence showing decoded
  vectors match extractListElem element-by-element.

- guardAndApply_eq_decode_bind invalid case: Handle the case when
  hasValidLengthNum returns a non-1 value.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract reusable helper lemmas (prSetupPhase_no_write_low, prLoopPrologue_no_write_high)
- Replace verbose by_cases/dite patterns with split_ifs
- Inline trivial let bindings as show expressions
- Remove redundant type annotations and show statements
- Use have instead of let for proof terms
- Consolidate duplicated register bound proofs

Net reduction of ~295 lines across 18 files.
Convert camelCase definitions and theorems to snake_case following
Mathlib/CSLib structural naming patterns:

- Definitions: maxRegister → max_register, shiftJumps → shift_jumps,
  isHalted → is_halted, fromInputs → of_inputs, etc.

- Theorems: halted_no_step → no_step_of_halted (uses _of_ pattern),
  write_read_same → write_read_self (uses _self pattern),
  halts_unique → eq_of_halts (describes result), etc.

- Module-specific renames in Composition/, Minimization/,
  PrimitiveRecursion/, and Simulate/ directories

All 43 files updated with consistent naming. Build passes.
@jessealama jessealama merged commit 4bc23a4 into main Jan 21, 2026
3 checks passed
@jessealama jessealama deleted the feature/partrec-prime-equivalence branch January 21, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant