Skip to content

Commit

Permalink
fix canonical ff record field attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
gares committed Mar 1, 2020
1 parent 9975f2e commit 7d2af42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/coq_elpi_builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,9 @@ It undestands qualified names, e.g. "Nat.t".|})),
begin match record_info with
| None -> () (* regular inductive *)
| Some field_specs -> (* record: projection... *)
let names, is_coercion =
List.(split (map (fun { name; is_coercion } -> name,
{ Record.pf_subclass = is_coercion ; pf_canonical = true })
let names, flags =
List.(split (map (fun { name; is_coercion; is_canonical } -> name,
{ Record.pf_subclass = is_coercion ; pf_canonical = is_canonical })
field_specs)) in
let is_implicit = List.map (fun _ -> []) names in
let rsp = (mind,0) in
Expand All @@ -937,7 +937,7 @@ It undestands qualified names, e.g. "Nat.t".|})),
Record.declare_projections rsp ~kind:Decls.Definition
(Evd.univ_entry ~poly:false sigma)
(Names.Id.of_string "record")
is_coercion is_implicit fields_as_relctx
flags is_implicit fields_as_relctx
in
Record.declare_structure_entry
(cstr, List.rev kinds, List.rev sp_projs);
Expand Down
10 changes: 8 additions & 2 deletions theories/tests/test_API.v
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,26 @@ Elpi Query lp:{{
Check myfalse.

(* record *)

Set Printing Universes.
Elpi Query lp:{{
DECL =
(parameter `T` {{Type}} t\
record "eq_class" {{Type}} "mk_eq_class" (
field [coercion tt] "eq_f" {{bool}} f\
field _ "eq_proof" {{lp:f = lp:f :> bool}} _\
field [canonical ff, coercion tt] "eq_f" {{bool}} f\
field _ "eq_proof" {{lp:f = lp:f :> bool}} _\
end-record)),
coq.say DECL,
coq.env.add-indt DECL GR.
}}.

Print eq_class.
Check (fun x : eq_class nat => (x : bool)).
Axiom b : bool.
Axiom p : b = b.
Canonical xxx := mk_eq_class bool b p.
Print Canonical Projections.
Fail Check eq_refl _ : eq_f bool _ = b.


(* inductive *)
Expand Down

0 comments on commit 7d2af42

Please sign in to comment.