@@ -80,18 +80,19 @@ let handle_require_as : compiler -> sig_state -> p_path -> p_ident ->
8080
8181(* * [handle_modifiers ms] verifies that the modifiers in [ms] are compatible.
8282 If so, they are returned as a tuple. Otherwise, it fails. *)
83- let handle_modifiers : p_modifier list -> prop * expo * match_strat * bool =
83+ let handle_modifiers : p_modifier list -> prop * expo * match_strat * bool * bool =
8484 fun ms ->
85- let rec get_modifiers ((props , expos , strats ,tc ) as acc ) = function
85+ let rec get_modifiers ((props , expos , strats ,tc , tci ) as acc ) = function
8686 | [] -> acc
87- | {elt =P_typeclass ;_} ::ms -> get_modifiers (props, expos, strats,true ) ms
88- | {elt =P_prop _ ;_} as p ::ms -> get_modifiers (p::props, expos, strats,tc) ms
89- | {elt =P_expo _ ;_} as e ::ms -> get_modifiers (props, e::expos, strats,tc) ms
87+ | {elt =P_typeclass ;_} ::ms -> get_modifiers (props, expos, strats,true , tci) ms
88+ | {elt =P_typeclass_instance ;_} ::ms -> get_modifiers (props, expos, strats,tc, true ) ms
89+ | {elt =P_prop _ ;_} as p ::ms -> get_modifiers (p::props, expos, strats,tc,tci) ms
90+ | {elt =P_expo _ ;_} as e ::ms -> get_modifiers (props, e::expos, strats,tc,tci) ms
9091 | {elt =P_mstrat _ ;_} as s ::ms ->
91- get_modifiers (props, expos, s::strats,tc) ms
92+ get_modifiers (props, expos, s::strats,tc,tci ) ms
9293 | {elt =P_opaq ;_} ::ms -> get_modifiers acc ms
9394 in
94- let props, expos, strats, tc = get_modifiers ([] ,[] ,[] ,false ) ms in
95+ let props, expos, strats, tc, tci = get_modifiers ([] ,[] ,[] , false ,false ) ms in
9596 let prop =
9697 match props with
9798 | [{elt= P_prop (Assoc b);_};{elt= P_prop Commu ;_}]
@@ -120,7 +121,7 @@ let handle_modifiers : p_modifier list -> prop * expo * match_strat * bool =
120121 | [] -> Eager
121122 | _ -> assert false
122123 in
123- (prop, expo, strat, tc)
124+ (prop, expo, strat, tc, tci )
124125
125126(* * [check_rule ss syms r] checks rule [r] and returns the head symbol of the
126127 lhs and the rule itself. *)
@@ -164,7 +165,7 @@ let handle_inductive_symbol : sig_state -> expo -> prop -> match_strat
164165 end ;
165166 (* Actually add the symbol to the signature and the state. *)
166167 Console. out 2 (Color. red " symbol %a : %a" ) uid name term typ;
167- let r = add_symbol ss expo prop mstrat false id typ impl false None in
168+ let r = add_symbol ss expo prop mstrat false id typ impl false false None in
168169 sig_state := fst r; r
169170
170171(* * Representation of a yet unchecked proof. The structure is initialized when
@@ -282,9 +283,11 @@ let get_proof_data : compiler -> sig_state -> p_command -> cmd_output =
282283
283284 | P_inductive (ms , params , p_ind_list ) ->
284285 (* Check modifiers. *)
285- let (prop, expo, mstrat,tc) = handle_modifiers ms in
286+ let (prop, expo, mstrat,tc,tci ) = handle_modifiers ms in
286287 if tc then
287288 fatal pos " Property typeclass cannot be used on inductive types." ;
289+ if tci then
290+ fatal pos " Property instance cannot be used on inductive types." ;
288291 if prop <> Defin then
289292 fatal pos " Property modifiers cannot be used on inductive types." ;
290293 if mstrat <> Eager then
@@ -351,7 +354,8 @@ let get_proof_data : compiler -> sig_state -> p_command -> cmd_output =
351354 (* Recursors are declared after the types and constructors. *)
352355 let pos = after (end_pos pos) in
353356 let id = Pos. make pos rec_name in
354- let r = add_symbol ss expo Defin Eager false id rec_typ [] false None
357+ let r =
358+ add_symbol ss expo Defin Eager false id rec_typ [] false false None
355359 in sig_state := fst r; r
356360 in
357361 (ss, rec_sym::rec_sym_list)
@@ -389,7 +393,7 @@ let get_proof_data : compiler -> sig_state -> p_command -> cmd_output =
389393 | _ -> ()
390394 end ;
391395 (* Verify modifiers. *)
392- let prop, expo, mstrat, tc = handle_modifiers p_sym_mod in
396+ let prop, expo, mstrat, tc, tci = handle_modifiers p_sym_mod in
393397 let opaq = List. exists Syntax. is_opaq p_sym_mod in
394398 let pdata_prv = expo = Privat || (p_sym_def && opaq) in
395399 (match p_sym_def, opaq, prop, mstrat with
@@ -494,7 +498,7 @@ let get_proof_data : compiler -> sig_state -> p_command -> cmd_output =
494498 Console. out 2 (Color. red " symbol %a : %a" ) uid id term a;
495499 wrn pe.pos " Proof admitted." ;
496500 let t = Option. map (fun t -> t.elt) t in
497- fst (add_symbol ss expo prop mstrat opaq p_sym_nam a impl tc t)
501+ fst (add_symbol ss expo prop mstrat opaq p_sym_nam a impl tc tci t)
498502 | P_proof_end ->
499503 (* Check that the proof is indeed finished. *)
500504 if not (finished ps) then
@@ -504,7 +508,7 @@ let get_proof_data : compiler -> sig_state -> p_command -> cmd_output =
504508 Option. map (fun m -> unfold (mk_Meta(m,[||]))) ps.proof_term in
505509 (* Add the symbol in the signature. *)
506510 Console. out 2 (Color. red " symbol %a : %a" ) uid id term a;
507- fst (add_symbol ss expo prop mstrat opaq p_sym_nam a impl tc d)
511+ fst (add_symbol ss expo prop mstrat opaq p_sym_nam a impl tc tci d)
508512 in
509513 (* Create the proof state. *)
510514 let pdata_state =
0 commit comments