Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Tragicus committed Jun 27, 2024
1 parent f6247a4 commit 67b6ef4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions HB/structure.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,21 @@ mk-sort-coercion-aux _ Structure P Args Clause :-
std.rev Args ArgsRev,
Clause =
(pi ctx v t e r argsAll w\ (coercion ctx v (app [Structure | ArgsRev]) e r :-
coq.say "try sort coercion",
std.append ArgsRev [v] argsAll,
coq.mk-app P argsAll w,
coq.say "find coercion from sort",
coq.elaborate-skeleton w e r ok,
coq.ltac.collect-goals r [] [])).
coq.ltac.collect-goals r [] [],
coq.say "sort coercion succeeds")).

pred mk-sort-coercion i:term, i:term, o:prop.
mk-sort-coercion Structure P Clause :-
coq.typecheck Structure T ok,
std.assert-ok! (coq.typecheck Structure T) "anomaly: mk-sort-coercion",
mk-sort-coercion-aux T Structure P [] Clause.

pred mk-reverse-coercion-aux i:term, i:term, i:term, i:list term, o:prop.
mk-reverse-coercion-aux (prod _N _T Body) Structure G Args Clause :-
Clause = (pi x\ C x),
mk-reverse-coercion-aux (prod _N _T Body) Structure G Args (pi x\ C x) :-
pi x\ mk-reverse-coercion-aux (Body x) Structure G [x | Args] (C x).

mk-reverse-coercion-aux _ Structure G Args Clause :-
Expand All @@ -322,7 +324,7 @@ mk-reverse-coercion-aux _ Structure G Args Clause :-

pred mk-reverse-coercion i:gref, o:prop.
mk-reverse-coercion Structure Clause :-
coq.typecheck (global Structure) T ok,
coq.env.typeof Structure T,
get-constructor Structure G,
mk-reverse-coercion-aux T (global Structure) (global G) [] Clause.

Expand Down
3 changes: 2 additions & 1 deletion structures.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Definition ignore {T} (x: T) := x.
Definition ignore_disabled {T T'} (x : T) (x' : T') := x'.

(* ********************* structures ****************************** *)
From elpi Require Import elpi coercion.
From elpi Require Import elpi.
From elpi.apps Require Import coercion.

Register unify as hb.unify.
Register id_phant as hb.id.
Expand Down

0 comments on commit 67b6ef4

Please sign in to comment.