Skip to content

Conversation

@gares
Copy link
Member

@gares gares commented Mar 5, 2021

No description provided.

@gares
Copy link
Member Author

gares commented Mar 5, 2021

CI: Error: Anomaly "Uncaught exception Failure("sep_last")." this is known bugs, on coq-elpi < 1.9.0 you cannot write Definition _ := ..., you need to put a name in there. This occurs in the test file.

@gares
Copy link
Member Author

gares commented Mar 7, 2021

One thing that is surely broken is the #[infer] attribute since we hardwire sortclass there, see #146 . I guess one may detect what the carrier is, but as a first approximation #[infer(P = "_ -> _")] may also work.

@gares gares force-pushed the demo-2021-03-05 branch from 0af7531 to 0ce37f5 Compare March 17, 2021 14:45
@gares
Copy link
Member Author

gares commented Mar 17, 2021

pred operation-body-and-ty i:list prop, i:constant, i:structure, i:term, i:term,
  i:list term, i:term, i:w-args A, o:pair term term.
operation-body-and-ty EXI Poperation Struct Psort Pclass Params _T (triple _ Params _) (pr Bo Ty) :- std.do! [
  mk-app (global Struct) Params StructType,
  mk-app Psort Params PsortP,
  mk-app Pclass Params PclassP,
  Bo = fun `s` StructType Body,
  Ty = prod `s` StructType BodyTy,
  (@pi-decl `s` StructType s\ sigma Carrier Class\ std.do! [
      mk-app PsortP [s] Carrier,
      mk-app PclassP [s] Class,
      synthesis.under-mixin-src-from-factory.do! Carrier Class [
        % just in case..
        synthesis.infer-all-mixin-args Params Carrier (const Poperation) (Body s),
        std.assert-ok! (coq.typecheck (Body s) (DirtyTy s)) "export-1-operation: Body illtyped",
        clean-op-ty EXI s (DirtyTy s) (BodyTy s),
      ],
  ]),
].

There is a problem/missing error message in this code. Params is used non-linearly, but in the silly test I wrote the parameters of the structure are not the same of the operation. This may not have much to do with this PR. Which is the right condition for giving an error?

In this case the structure has 2 parameters, the first occurrence, but the operation (mixin) zero.

@gares
Copy link
Member Author

gares commented Mar 17, 2021

I think I fixed the code.
@CohenCyril is the infer thing acceptable or you have a better idea?

@gares
Copy link
Member Author

gares commented Mar 17, 2021

It seems 8.11 has some problem, it rings a bell... I just don't recall if it was a bug in coq-elpi (for that version of Coq) or Coq itself.

@gares
Copy link
Member Author

gares commented Mar 17, 2021

Given the prints, it is coq-elpi that declares a silly notation.

@gares
Copy link
Member Author

gares commented Mar 17, 2021

@CohenCyril this PR is now ok, for what I can tell. You had some comments on the code I wrote during the demo you may put here.

@CohenCyril
Copy link
Member

Looks ok but without extensive testing on mathcomp I find it a bit scary...

@gares
Copy link
Member Author

gares commented Mar 17, 2021

Then we should merge it and document it as experimental. Otherwise it is harder to test.

@CohenCyril
Copy link
Member

ok, let's merge the big one first!

@gares gares force-pushed the demo-2021-03-05 branch from f9105c4 to 15cf186 Compare March 17, 2021 17:55
@gares
Copy link
Member Author

gares commented Mar 17, 2021

rebased

@CohenCyril
Copy link
Member

I may have to rebase again after #187 ...

@gares
Copy link
Member Author

gares commented Mar 18, 2021

About axioms_.
(* axioms_ : forall T : Type, (T -> T -> T) -> Prop

axioms_ is not universe polymorphic
Arguments axioms_ _%type_scope _%function_scope
Expands to: Inductive funclass.Magma.axioms_ *)
Notation on X1 :=  (phant_on_ _ _ (ssreflect.Phantom (forall H, _) X1) : axioms_ _ X1).
(* Error: X1 is here used in the empty scope stack while it was elsewhere used in scope function_scope *)

This looks like a real problem in Coq, but I'm not sure what it means.
I mean, I can make it pass by writing X1%function in the first occurrence of X1, but this is too hard.

@CohenCyril
Copy link
Member

I mean, I can make it pass by writing X1%function in the first occurrence of X1, but this is too hard.

I am not sure what an automated scope inference could do to improve on this though...

@gares
Copy link
Member Author

gares commented Mar 18, 2021

Notation on X1 := ((fun a => (phant_on_ _ _ (ssreflect.Phantom _ a) : axioms_ _ a)) X1).
(* OK *)

Seriously?

@gares
Copy link
Member Author

gares commented Mar 19, 2021

CC rocq-prover/rocq#13965

@gares gares force-pushed the demo-2021-03-05 branch from 0306ee9 to 1308e48 Compare March 24, 2021 08:49
@gares
Copy link
Member Author

gares commented Mar 24, 2021

It is not so clear to me what to do here. The PR is ready, but logging is broken waiting for rocq-prover/rocq#13965

@gares
Copy link
Member Author

gares commented Mar 24, 2021

I mean, it will break also in mathcomp if we start using morphisms

@gares gares added this to the 1.1.0 milestone Mar 25, 2021
@gares
Copy link
Member Author

gares commented Mar 25, 2021

look for a work around on 8.13 or postpone

@gares gares modified the milestones: 1.1.0, 1.2.0 Mar 25, 2021
@gares gares force-pushed the demo-2021-03-05 branch 3 times, most recently from 526edb5 to 4787a3f Compare March 26, 2021 09:02
@gares gares modified the milestones: 1.2.0, 1.1.0 Mar 26, 2021
@gares gares force-pushed the demo-2021-03-05 branch from b05a23a to 41b266f Compare March 29, 2021 10:24
@gares gares force-pushed the demo-2021-03-05 branch from a0fc96a to 44d8cd1 Compare March 29, 2021 10:36
@gares gares force-pushed the demo-2021-03-05 branch from 44d8cd1 to e99487e Compare March 29, 2021 11:07
@gares gares merged commit 021e2bc into master Mar 29, 2021
@gares gares deleted the demo-2021-03-05 branch March 29, 2021 11:21
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