Skip to content

Unification#48

Merged
jespercockx merged 36 commits intojespercockx:mainfrom
EwenBC:main
Mar 18, 2025
Merged

Unification#48
jespercockx merged 36 commits intojespercockx:mainfrom
EwenBC:main

Conversation

@EwenBC
Copy link
Collaborator

@EwenBC EwenBC commented Nov 4, 2024

Creation of the rules for an unification algorithm which update context by solving a telescopic equality

Algorithm:

Input:

  • a context Γ and a telescope equality ΔEq.

Output:

  • a new context Γ' ⊆ Γ where some variables of Γ have been replaced by their value from the unification
  • an equivalence between (Γ, ΔEq) and Γ'.

Example:

Input:

  • Γ := (m n : ℕ)(x y : A)(xs : Vec A m)(ys : Vec A n)
  • ΔEq := (e₁ : suc m ≡ suc n)(e₂ : cons m x xs ≡(Vec A e₁) cons n y ys)

Output:

  • Γ' := (m : ℕ)(x : A)(xs : Vec A m)
  • σ : (Γ, ΔEq) → Γ'
  • τ : Γ' → (Γ, ΔEq)
  • (maybe) e: ∀ x, σ τ x = x
  • (maybe) e': ∀ x, τ σ x = x

For more:

Implementation based on Proof-relevant unification: Dependent pattern matching with only the axioms of your type theory by Jesper Cockk and Dominique Devriese.

EwenBC and others added 30 commits November 4, 2024 14:19
	modified:   src/Agda/Core/Notations.md
	modified:   src/Agda/Core/Unification.agda
	modifié :         src/Agda/Core/Unification.agda

	modified:   src/Agda/Core/Unification.agda
comes from the scope library, In is inlined
	modified:   src/Agda/Core/Signature.agda
	modified:   src/Agda/Core/Typechecker.agda
	modified:   src/Agda/Core/Typing.agda

	modified:   src/Agda/Core/Signature.agda
	modified:   src/Agda/Core/Typechecker.agda
	modified:   src/Agda/Core/Typing.agda

 Date:      Wed Jan 16 15:16:12 2025 +0100

Date:      Wed Jan 16 15:16:12 2025 +0100
	modified:   src/Agda/Core/Signature.agda
	modified:   src/Agda/Core/Typechecker.agda
	modified:   src/Agda/Core/Typing.agda
@EwenBC EwenBC marked this pull request as ready for review March 17, 2025 09:45
Copy link
Owner

@jespercockx jespercockx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this took a while to get to! I noticed there are still a few things that are WIP but if that's intentional then I'm okay with merging this.


pattern ⌈⌉ = EmptyTel
infix 6 ⌈_∶_◃_⌉
pattern ⌈_∶_◃_⌉ x t Δ = ExtendTel x t Δ
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal taste here would be to omit the and in the ⌈_∶_◃_⌉ syntax. You can always put regular parenthesis where desired.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to change this notation in the pull request that I started yesterday ? (As doing so here will create a conflict between the two pull request.)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's fine with me.

@EwenBC
Copy link
Collaborator Author

EwenBC commented Mar 18, 2025

I noticed there are still a few things that are WIP but if that's intentional then I'm okay with merging this.

In the unifier file ? I started this file here but thought that it could be done in another pull request instead and commented the unfinished part.
If its elsewhere, it is not intentional.

@jespercockx
Copy link
Owner

I meant the parts you just removed now. I'll go ahead and merge this so we can continue the discussion in the other PR!

@jespercockx jespercockx merged commit b673982 into jespercockx:main Mar 18, 2025
2 checks passed
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.

3 participants