-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Unordered Pair #891
Added Unordered Pair #891
Conversation
Did you see the finite multisets: https://github.com/agda/cubical/blob/master/Cubical/HITs/FiniteMultiset/Base.agda ? |
Yes, I know the relation. I will try to put in the properties. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a renaming request...
Maybe you can add a comment? Something like "the relation to ... should be ...". |
I was trying to define the recursive definition: FMSet : (A : Type ℓ) (n : ℕ) → Type ℓ
FMSet A 0 = Unit*
FMSet A 1 = A
FMSet A (suc (suc n)) = {!!} And I figured out that it is not possible to do, because both elements need to be of the same type.
Because of that, what I commented before was wrong. |
I figured out how to do: addN : UnorderedPair (A × ℕ) → ℕ
addN = rec isSetℕ (λ x y → proj₂ x + proj₂ y) λ x y → +-comm (proj₂ x) (proj₂ y)
data FMSet (A : Type ℓ) : ℕ → Type ℓ where
one : A → FMSet A 1
join : (xs : UnorderedPair (A × ℕ)) → FMSet A (addN xs) |
Since this construction is limited to the sets, wouldn't it be cleaner to implement it by a set-coequalizer? Consider the coequalizer of |
Thanks for your suggestion. I proved that both are isomorphic. |
As I just learned in the hallway, there is also an untruncated unordered pair notion, defined as maps from a set merely equivalent to Fin 2 to A. I guess for A a Set the Set-truncation of that notion should agree with your notion? |
I didn't understand. Can you give a code example? |
Let Σ[ X ∈ Type ] (∥ X ≃ Bool ∥ × X → A) This construction is at least a groupoid, but for A of h-level ≥ 3, it preserves h-levels. The idea is that, in the same way that a pair in A is the same as a function The pairing Bool , inc id , λ { true → x; false → y } This is equal to the pairing |
I am trying to do your implementation, but I am in trouble. What am I doing wrong? UPairBool : Type ℓ → Type _
UPairBool A = Σ[ X ∈ Type ] (∥ X ≃ Bool ∥₁ × (X → A))
private
uP₁ : UPairBool Bool
uP₁ = Bool , ∣ idEquiv Bool ∣₁ , λ where false → false ; true → true
uP₂ : UPairBool Bool
uP₂ = Bool , ∣ notEquiv ∣₁ , λ where false → true ; true → false
uP₁≡uP₂ : uP₁ ≡ uP₂
uP₁≡uP₂ i = Bool , squash₁ ∣ idEquiv Bool ∣₁ ∣ notEquiv ∣₁ i , {!!} |
What you are trying to prove is true. The first part of your term |
Also, isn't that the set-truncation? The equivalence has to be propositionally-truncated. |
|
I am in trouble trying to prove this thing: uP₁≡uP₂ : uP₁ ≡ uP₂
uP₁≡uP₂ = ΣPathP (notEq , ΣPathP (helper₁ , helper₂)) where
helper₁ : PathP (λ z → ∥ notEq z ≃ Bool ∥₁) ∣ idEquiv Bool ∣₁ ∣ notEquiv ∣₁
helper₁ i = {!squash₁ ∣ idEquiv Bool ∣₁ ∣ notEquiv ∣₁ i!}
helper₂ : PathP (λ i → notEq i → Bool) (idfun Bool) not
helper₂ i b = {!!} |
You can, of course, also postpone the proof and wrap up the current PR... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of comments and questions.
Sorry for the long wait and thanks for the updates. I am a bit puzzled about the recursive FMSets - maybe it is better to save those for a PR where you prove something about them? All the other files look good to me. |
I deleted the recursive file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - will merge it now...
I created Unordered Pair, which means that
a , b = b , a
.