Comments (14)
I wouldn't rename it just because it would make things a bit confusing for anyone who's coming from standard Agda. It might be worth it to add a comment about this though (even though it is clear if you look at the code :-) )
from cubical.
I don't know about anyone else, but I'd still like to have _∘_
be general function composition.
from cubical.
Maybe not rename it but when you experiment with Agda you can do something like _$_
for cong
. If you define precedence right it may save you quite a few brackets (so instead of cong f (cong g (complicated p))
you can have f $ g $ complicated p
)
from cubical.
Maybe not rename it but when you experiment with Agda you can do something like
_$_
forcong
. If you define precedence right it may save you quite a few brackets (so instead ofcong f (cong g (complicated p))
you can havef $ g $ complicated p
)
cong
has a very direct proof in Cubical Agda and I like to inline it. Your example would then be \ i -> f (g (complicated p i))
. Still quite a few parantheses, but you don't need to write cong
.
from cubical.
cong
has a very direct proof in Cubical Agda and I like to inline it. Your example would then be\ i -> f (g (complicated p i))
. Still quite a few parantheses, but you don't need to writecong
.
Ah good point. I really wish compPath
can be easily inline as well.
from cubical.
Maybe we should have another name for compPath
... Like semicolon or just a dot.
from cubical.
Maybe we should have another name for
compPath
... Like semicolon or just a dot.
Yeah that sounds like a good idea! _∙_
(Enter ∙
by \.
) should be good.
BTW I just tried inline some of the proofs but once inlined Agda complains about Termination checking failed
. Is this a known issue?
This is the one I tried: (https://github.com/agda/cubical/blob/master/Cubical/Data/Int/Properties.agda#L268)
{-
minusPlus (negsuc (suc m)) n =
predInt (sucInt (sucInt (n +pos m)) +negsuc m) ≡⟨ predInt+negsuc m (sucInt (sucInt (n +pos m))) ⟩
predInt (sucInt (sucInt (n +pos m))) +negsuc m ≡⟨ cong (λ z → z + negsuc m) (predSuc (sucInt (n +pos m))) ⟩
sucInt (n +pos m) +negsuc m ≡⟨ minusPlus (negsuc m) n ⟩
n ∎
-}
minusPlus (negsuc (suc m)) n i =
hcomp (λ j → \ { (i = i0) → (predInt+negsuc m (sucInt (sucInt (n +pos m))) (~ j))
; (i = i1) → minusPlus (negsuc m) n j }) (predSuc (sucInt (n +pos m)) i + negsuc m)
Using the commented version is fine. But using the uncommented one, it complains.
from cubical.
@3abc I've noticed before that the termination checker doesn't deal well with pattern matching lambdas, at least ones used for systems. I wonder if making it its own definition helps.
I really like the idea of defining _∙_
as a synonym for compPath
btw.
from cubical.
I really like the idea of defining
_∙_
as a synonym forcompPath
btw.
What will be a good fixity for _∙_
?
I suggest Infix, and higher than function application. I wish one can write λ i → f p∙q i
for cong f (compPath p q)
without having to write parentheses.
BTW currently λ i → p i
doesn't fit well with equational reasoning: ≡⟨ λ i → f p i ⟩
won't work, one have to do ≡⟨ (λ i → f p i) ⟩
, so sometimes it still make sense to write ≡⟨ cong f p ⟩
instead of inline it.
from cubical.
I suggest Infix, and higher than function application. I wish one can write
λ i → f p∙q i
forcong f (compPath p q)
without having to write parentheses.
I think of path composition as multiplication (in the groupoid of paths) so having it bind harder than function application is very confusing (consider λ i → f p ∙ q i
)
from cubical.
BTW currently
λ i → p i
doesn't fit well with equational reasoning:≡⟨ λ i → f p i ⟩
won't work, one have to do≡⟨ (λ i → f p i) ⟩
, so sometimes it still make sense to write≡⟨ cong f p ⟩
instead of inline it.
If one can fix this by changing the fixity of the eq reasoning that would be nice. I just copied the current setup from the standard library without thinking about it. I'm in fact allergic to thinking about fixity, so I would be happy if someone else wants to play around with it :-)
from cubical.
Lambdas are quite special, so I don't think fixities can solve this.
However we can have special syntax
for equality reasoning that binds the i
.
Then it could look like ≡λ i ↦ f p i ⟩
or so.
from cubical.
I think of path composition as multiplication (in the groupoid of paths) so having it bind harder than function application is very confusing (consider
λ i → f p ∙ q i
)
Yeah I think of it that way too. Maybe λ i → f (p ∙ q) i
is good enough.
from cubical.
However we can have special
syntax
for equality reasoning that binds thei
.
Then it could look like≡λ i ↦ f p i ⟩
or so.
Actually I found that the reason of wanting some syntactic sugar for cong
is sometimes in equational reasoning, having to keep writing cong
and a function is annoying, like
longFunction x ≡⟨ cong longFunction p ⟩
longFunction y ≡⟨ cong longFunction q ⟩
longFunction z ≡⟨ cong longFunction r ⟩
longFunction t ≡⟨ ... ⟩
_ ∎
especially when p, q, r
are complicated too. However I just realized these can be written as
longFunction x ≡⟨ cong longFunction (
x ≡⟨ p ⟩
y ≡⟨ q ⟩
z ≡⟨ r ⟩
t ∎ ) ⟩
longFunction t ≡⟨ ... ⟩
_ ∎
so I'm happy with cong
for now.
from cubical.
Related Issues (20)
- Citation.cff HOT 4
- Where should `π₁(RP²)` be? HOT 1
- Duplication of code in the library HOT 3
- Note licence exceptions HOT 2
- Slightly more generalized universes HOT 1
- Remove `isSet` accessors for algebraic structures? HOT 3
- Change the Constructor Name of Sequential Colimits HOT 2
- CI workflow with current agda master HOT 5
- Additions to the powerset module HOT 2
- Some Files are never checked HOT 6
- Suggested heap size for CI HOT 1
- SumMap in Algebra.Ring.BigOps should come from Semirings /Monoids HOT 1
- `make` fails on macOS Sonoma 14.2.1 with Apple Silicon HOT 1
- Algebraic geometry HOT 2
- Figure out why the CommRingSolver doesn't work in this case HOT 5
- Make the CommRingSolver work better with concrete rings
- More elegant construction of ZariskiLattice HOT 2
- Solver for wild categories
- arithmetic operations of Cubical.Data.Rationals is super slow HOT 1
- Naming Convention for Disambiguation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cubical.