Skip to content
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

second attempt at finite csp instance type #96

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

williamdemeo
Copy link
Member

Not sure this is the best way to do this... so marking it "draft"

Copy link
Collaborator

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

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

I agree with your doubts that this is the right way to go.

UniversalAlgebra/Complexity/FiniteCSP.lagda Outdated Show resolved Hide resolved
UniversalAlgebra/Complexity/FiniteCSP.lagda Outdated Show resolved Hide resolved
UniversalAlgebra/Complexity/FiniteCSP.lagda Outdated Show resolved Hide resolved
record CSPInstance (nvar : ℕ) (dom : Vec (DecSetoid α ℓ) nvar) : Type α where
field
ncon : ℕ -- the number of constraints involved
constr : Vec (Constraint nvar dom) ncon
Copy link
Collaborator

Choose a reason for hiding this comment

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

So I would actually go with a list of constraints, until knowing the number of constraints involved in advance actually makes a difference. My guess is, it won't matter.

Copy link
Member Author

Choose a reason for hiding this comment

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

So, List is better than Vec here? Any particular reason why?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Vec is useful when knowing the length 'statically' matters - otherwise might as well go with List.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooops, I forgot to convert the vector of constraints to a list of constraints! I'll do that now.

P : Constraint nvar dom → Bool
P c = (satisfies c) f

-- A more general version...? (P is a more general Pred)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is right - P is a special case of Pred. In two ways, both what the input is, and what kind of type it returns. Also, I think this can be "said" with T.

Copy link
Member Author

Choose a reason for hiding this comment

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

I suspect you're right and there's something wrong here. Again, it probably stems from my poor understanding of how to view general predicates. I'll have to think more about this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A predicate maps to a whole type's worth of evidence that the predicate holds (or none at all if it doesn't). true just says it holds and absolutely nothing else. Bool is slightly different though, because a Bool-valued function is equivalent to a proof-irrelevant decidable predicate.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see. Very nice explanation! Thank you, Jacques!!

@williamdemeo williamdemeo marked this pull request as ready for review July 29, 2021 10:27
Copy link
Member Author

@williamdemeo williamdemeo left a comment

Choose a reason for hiding this comment

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

satisfies is defined that way, and not simply f ∈ rel because f only needs to agree with a member of rel on the scope s, not over the whole domain.

Copy link
Member Author

@williamdemeo williamdemeo left a comment

Choose a reason for hiding this comment

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

But I agree, there is probably a better way to do this... I'll keep working on and trying to improve it.

@JacquesCarette
Copy link
Collaborator

The problem is that this g comes out of nowhere. So yes, a solution can be arbitrary-valued outside the scope. It feels like maybe the right way to do that is to

  1. use the information order on predicates
  2. check against a combination of s and rel

I.e. make a predicate from s and then intersect it with rel.

...but at least I now know a little bit more about `Prop`, `Bool`, and `Dec`.

**Question**. Suppose

```agda
∀ i → Dec (f i ≈ g i)
```

and suppose we define

```agda
f ≐ g = ∀ i → f i ≈ g i
```

Can we then prove `Dec (f ≐ g)`?

(That's what we need in the hole on line 142, and that what I'm trying to do in
lines 129--134.  I have the `Bool` part, but I still need the `Reflects (f ≐ g)` part.)
@williamdemeo
Copy link
Member Author

Question. Suppose

 i  Dec (f i ≈ g i)

and suppose we define

f ≐ g =  i  f i ≈ g i

Can we then prove Dec (f ≐ g)?

(That's what we need in the hole on line 142, and that what I'm trying to do in
lines 129--134. I have the Bool part, but I still need the Reflects (f ≐ g) part.)

@JacquesCarette
Copy link
Collaborator

That's an extensionality property - you're asking for a pointwise proof to 'upgrade' to a uniform proof.

@williamdemeo
Copy link
Member Author

williamdemeo commented Aug 2, 2021 via email

@JacquesCarette
Copy link
Collaborator

If you represent f and g as Vec, so that the finiteness is apparent, instead of being hidden under a function, then it is provable.

@williamdemeo williamdemeo marked this pull request as draft October 16, 2023 06:47
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.

2 participants