Skip to content

Consequences as consequences for properties, or consequences for structured sets? #455

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

Closed
HuStmpHrrr opened this issue Sep 6, 2018 · 7 comments

Comments

@HuStmpHrrr
Copy link
Member

I find that there is a duplication between *.Consequences and *.Properties for structured sets, mainly including algebraic and order theories. I find the line between the consequences from functional properties and ones from structured sets is very blurred.

Consider, for example, https://github.com/agda/agda-stdlib/blame/master/src/Algebra/FunctionProperties/Consequences.agda#L103

assoc+id+invʳ⇒invˡ-unique :  {_•_ _⁻¹ ε} 
                           Congruent₂ _•_  Associative _•_ 
                           Identity ε _•_  RightInverse ε _⁻¹ _•_ 
                            x y  (x • y) ≈ ε  x ≈ (y ⁻¹)

This law effectively unpacks monoid into a bunch of antecedents, plus a right inverse. Shouldn't it be something like

monoid+invʳ⇒invˡ-unique :  {_•_ _⁻¹ ε}  IsMonoid _•_ ε  RightInverse ε _⁻¹ _•_ 
                            x y  (x • y) ≈ ε  x ≈ (y ⁻¹)

?

Then it's very clear by reading it as what if a monoid possesses some other things, what happens. I sometimes find claiming laws like this in *.Consequences is an overkill. Any thoughts on drawing a line?

@MatthewDaggitt
Copy link
Contributor

So the problem is that you can't use IsMonoid in Algebra.FunctionProperties.Consequences as Algebra.Structures depends on it so you end up with a dependency cycle. You're right though that the above identity should probably be in Algebra.Properties.Monoid...

You're right though, it's difficult to draw the line. Hypothetically if the above property didn't require congruence, where would it belong then?

@JacquesCarette
Copy link
Contributor

Not requiring congruence would be very weird... even a Magma requires it, no? Hmm, I notice Magma isn't even defined in Algebra.Structures!

@HuStmpHrrr
Copy link
Member Author

i think congruence can be one of the criteria. The dilemma here is "what properties we want to put as a part of the definitions", which effectively prevents us from deriving properties from structured sets. if we view it in this way, it's a modularity problem in probably all languages.

Though, if a property is easy, what prevents us from inlining the definitions directly?

@JacquesCarette
Copy link
Contributor

The drawback of inlining definitions is that this makes the recognition problem much harder: to 'see' that in two apparently dissimilar situations, there is actually a large core that is common, and can be abstracted out. By naming definitions that recur, the recognition problem becomes easier.

Which is, in fact, the core of your suggestion regarding using IsMonoid in this issue!

@HuStmpHrrr
Copy link
Member Author

HuStmpHrrr commented Sep 8, 2018

I guess there are different understandings of inlining here. I should probably pick another word. I think the recognition problem should only be about recognizing structures, instead of a set of properties. For example, in commutative monoid, deriving identityʳ uses left identity and commutativity.

https://github.com/agda/agda-stdlib/blob/master/src/Algebra/Structures.agda#L67

One rarely considers a set of properties in isolation. Monoid is already a very general and common structure. Suppose we directly prove right identity, I don't think we lose too much generality. A structure with no more information than left identity and commutativity is strange. Sure, if a larger proof requires right identity here, we should not inline the proof of left identity and commutativity there.

@JacquesCarette
Copy link
Contributor

That proof really belongs in a 'left unital commutative semigroup'; and that would then make it provable that it is in fact a commutative monoid.

At this level, that sounds a bit ridiculous. But in other situations, when the proof is non-trivial, or higher up (semigroupoid), then these do start to matter.

@MatthewDaggitt
Copy link
Contributor

Hmm, as I mentioned earlier in the thread, the Consequences files are often useful (/vital) to have when you don't necessarily have a full algebraic structure constructed yet. As this issue doesn't seem to have a concrete suggestion, and that I don't think the current situation is actively problematic, I'm going to close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants