Skip to content

core code missing from Nat and Int#1304

Open
reswatson wants to merge 3 commits into
agda:masterfrom
reswatson:natsIntsPR
Open

core code missing from Nat and Int#1304
reswatson wants to merge 3 commits into
agda:masterfrom
reswatson:natsIntsPR

Conversation

@reswatson
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread Cubical/Data/Nat/GCD.agda Outdated
gcd[m,n]∣n m n = transport (cong (λ a → a ∣ n) (gcdSym n m) ) (gcd[m,n]∣m n m)

gcd-greatest : c ∣ m → c ∣ n → c ∣ gcd m n
gcd-greatest c∣m c∣n =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there any reason why it is proved in this way, instead of currying snd (gcdIsGCD m n) c?
I tested it, and you could even write gcd-greatest = curry (snd (gcdIsGCD _ _) _), with all implicit varibles solved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread Cubical/Data/Nat/GCD.agda Outdated
⊥.elim {A = λ bot → suc m ≡ 0} (gcd[m,n]≢0 (suc m) n (inl snotz) gmn)

gcd[m,n]≡0⇒n≡0 : ∀ {m n} → gcd m n ≡ 0 → n ≡ 0
gcd[m,n]≡0⇒n≡0 {m}{n} gmn = gcd[m,n]≡0⇒m≡0 {n}{m}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

transporting on cong (λ a → a ≡ 0) is the same as composing with the reverse path. In my opinion, it would be better to write gcd[m,n]≡0⇒m≡0 {n} {m} (gcdSym n m ∙ gmn), avoiding unnecessary transports.
More generally, I see you are using multiple times the pattern transport + cong, where you could have used subst instead.
However, I'm not a maintainer; I just noticed a couple of places where the code could be made shorter. Feel free to ignore these comments if not relevant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I'll look at this shortly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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