Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/tool/sr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ let check_rule : Pos.popt -> sym_rule -> sym_rule =
if not (Unif.solve_noexn ~type_check:false p) then
fatal pos "The LHS is not typable.";
(* Try to simplify constraints. *)
let norm_constr (c,t,u) = (c, Eval.snf [] t, Eval.snf [] u) in
let lhs_constrs = List.map norm_constr !p.unsolved in
let norm_constr (c,t,u) =
(c, Eval.snf [] (cleanup t), Eval.snf [] (cleanup u)) in
let lhs_constrs =
List.filter (fun (_,t,u) -> Term.cmp t u <> 0)
(List.map norm_constr !p.unsolved) in
if Logger.log_enabled () then
log_subj "@[<v>LHS type: %a@ LHS constraints: %a@ rule: %a ↪ %a@]"
term ty_lhs constrs lhs_constrs
Expand Down Expand Up @@ -207,7 +210,9 @@ let check_rule : Pos.popt -> sym_rule -> sym_rule =
(* Solving the typing constraints of the RHS. *)
if not (Unif.solve_noexn p) then
fatal pos "The rewriting rule does not preserve typing.";
let rhs_constrs = List.map norm_constr !p.unsolved in
let rhs_constrs =
List.filter (fun (_,t,u) -> Term.cmp t u <> 0)
(List.map norm_constr !p.unsolved) in
(* [matches p t] says if [t] is an instance of [p]. *)
let matches p t =
let rec matches s l =
Expand Down
25 changes: 25 additions & 0 deletions tests/OK/ind_AC.lp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
symbol Prop : TYPE;
injective symbol π: Prop → TYPE;
builtin "Prop" ≔ Prop;
builtin "P" ≔ π;

symbol context: TYPE;
symbol □ : context;
associative commutative symbol ∙ : context → context → context;

notation ∙ infix right 1;

symbol γ: Prop → context;
rule □ ∙ $H ↪ $H;

inductive valid1: context → TYPE ≔
| R1 h1 h2 : valid1 (h1 ∙ h2) → valid1 h2;

inductive valid2: context → TYPE ≔
| R2 h1 h2 : valid2 (h1 ∙ h2) → valid2 h1;

inductive valid3: context → TYPE ≔
| R3 p h : valid3 (h ∙ γ p) → valid3 h;

inductive valid4: context → TYPE ≔
| R4 p h : valid4 (γ p ∙ h) → valid4 h;
2 changes: 1 addition & 1 deletion tests/export_raw_dk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ do
# "as"
729);;
# "notation"
xor|Set|quant*|Prop|prefix|parametricCoercions|opaque|nat_id*|michael|max-suc-alg|lpparse|861|infix|infer|indrec|implicitArgs[34]|group|cr_qu|cp*|coercions|plus_ac|693|693_assume|679|665|655|655b|649_fo_27|595_and_elim|584_c_slow|579_or_elim_long|579_long_no_duplicate|359|328|245|245b|244|1026|991|706|1101|1190b|1190c|1120|1247|decimal);;
xor|Set|quant*|Prop|prefix|parametricCoercions|opaque|nat_id*|michael|max-suc-alg|lpparse|861|infix|infer|indrec|implicitArgs[34]|group|cr_qu|cp*|coercions|plus_ac|693|693_assume|679|665|655|655b|649_fo_27|595_and_elim|584_c_slow|579_or_elim_long|579_long_no_duplicate|359|328|245|245b|244|1026|991|706|1101|1190b|1190c|1120|1247|decimal|ind_AC);;
# "quantifier"
683|650|573|565|430);;
# nested module name
Expand Down
Loading