Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added current goal info to dependent evars line #2

Open
wants to merge 3 commits into
base: dependent_evars
Choose a base branch
from

Conversation

hendriktews
Copy link

  • added option to first print_dependent_evars arg to fix typing error
  • folded mapping info into the first part, removing other mapping info code
  • deleted code that made the output prettier - this is not for humans anyway
  • added info for evars in the current goal - this also contains
    instantiated evars, users interested in only the open ones need to filter
    themselves
  • change pr_subgoals to call print_dependent_evars without a goal argument,
    when pr_first is false - these are the cases when there is no current goal

jfehrle and others added 3 commits July 20, 2019 13:11
- added option to first print_dependent_evars arg to fix typing error
- folded mapping info into the first part, removing other mapping info code
- deleted code that made the output prettier - this is not for humans anyway
- added info for evars in the current goal - this also contains
  instantiated evars, users interested in only the open ones need to filter
  themselves
- change pr_subgoals to call print_dependent_evars without a goal argument,
  when pr_first is false - these are the cases when there is no current goal
@@ -741,7 +739,8 @@ let pr_subgoals ?(pr_first=true) ?(diffs=false) ?os_map
pr_rec 1 (g::l)
in
let pr_evar_info gl sigma seeds =
print_evar_constraints gl sigma ++ print_dependent_evars gl sigma seeds
let first_goal = if pr_first then gl else None in
print_evar_constraints gl sigma ++ print_dependent_evars first_goal sigma seeds
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added option to first print_dependent_evars arg to fix typing error

Actually because you're passing None here, so of course you need to update the declaration

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course not. The None is inside an if, therefore gl must have (and always had) the type Goal.goal option. Otherwise the compiler would complain about incompatible types in this line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see the typing error, if you annotate the gl argument of print_dependent_evars in printer.ml with the type that you require in printer.mli in 912527f.

if !should_print_dependent_evars then
let evars = Evarutil.gather_dependent_evars sigma seeds in
let evars_pp = Evar.Map.fold (fun e i s ->
let e' = pr_internal_existential_key e in
let sep = if s = (str "") then "" else ", " in
s ++ str sep ++ e' ++
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted code that made the output prettier - this is not for humans anyway

This seems to be just a minor difference in coding style/opinion, not essential to the goal of the PR. Better to avoid unnecessary changes unless there is a good reason. It distracts from the important changes. Everyone's style is a bit different.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't say it's coding style - it's about the style and readability of the produced output. But I agree, it is not essential.

cut () ++ cut () ++
str "(dependent evars: " ++ evars_pp ++ str ";" ++ cut () ++
str "mapping: " ++ (pr_map sigma map_evars) ++ str ")"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

folded mapping info into the first part, removing other mapping info code

Was this a necessary change or nice to have? Just to be clear.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are three changes in these two lines, for every one the answer is different:

  • removal of cut (): this is a code simplification, neither necessary nor related to the goal of the PR, similar to the simplification of the separators above.
  • removal of pr_map: Not necessary, but very nice to have. I produce the mapping information in a, IMO, much simpler way, without the pr_map function and the calls to Evar.Map.bindings that were introduced in 912527f. As I said before, I would suggest to squash an updated version of this change with 912527f, such that pr_map will never appear in the master branch.
  • addition of evars_current_pp: necessary, this produces the output according to requirement 4 of Incomplete evars info when 'Printing Dependent Evars Line' enabled coq/coq#10420

@hendriktews
Copy link
Author

hendriktews commented Jul 24, 2019 via email

jfehrle added a commit that referenced this pull request Jul 26, 2019
let evars_current = Evarutil.gather_dependent_evars sigma [ gl ] in
Evar.Map.fold (fun e _ s ->
s ++ (pr_internal_existential_key e) ++ (str " "))
evars_current (str "current goal: ")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 The output after the eapply strange_imp_trans step is:

(dependent evars: ?X4 : ?P open, ?X5 : ?Q open, ; current goal: ?X5 )

However, the current goal is actually ?Goal. ?X5 = ?Q is not. Is the label current goal wrong or is the value wrong?

eapply strange_imp_trans.
4 focused subgoals
(shelved: 2) (ID 6)

  P1, P2, P3, P4 : Prop
  p12 : P1 -> P2
  p123 : (P1 -> P2) -> P3
  p34 : P3 -> P4
  ============================
  ?Q -> P4

subgoal 2 (ID 7) is:
 ?P -> ?Q
subgoal 3 (ID 8) is:
 ?P -> ?Q
subgoal 4 (ID 9) is:
 ?P

p14 < Show Existentials.
  <excerpted>
Existential 3 =
?Goal : [P1 : Prop
         P2 : Prop
         P3 : Prop
         P4 : Prop
         p12 : P1 -> P2
         p123 : (P1 -> P2) -> P3
         p34 : P3 -> P4 |- ?Q -> P4]

2 It's odd to see fold here, which suggests there could be multiple elements in the mapping. There can only be one current goal. Would be clearer with something that makes this clear, such as Evar.Map.find_first. You might add a temporary check that Evar.Map.cardinal is 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, the current goal is actually ?Goal. ?X5 = ?Q is not. Is the label current goal wrong or is the value wrong?

The evars after current goal are the evars used inside the current goal, see the feature description in coq#10420. This is not the current goal.

2 It's odd to see fold here, which suggests there could be multiple elements in the mapping. There can only be one current goal.

Please read my comment in PR coq#10489 from Jul 24, 2019, 10:42 pm GMT+2, there you see an example with multiple evars after current goal. The code uses Evarutil.gather_dependent_evars, which does not return the current goal, but rather all the evars used in the evar argument list, which is something completely different in most cases.

jfehrle added a commit that referenced this pull request Jul 28, 2019
@jfehrle jfehrle force-pushed the dependent_evars branch 3 times, most recently from 1af4f8b to 1d5eba7 Compare August 3, 2019 21:06
@jfehrle jfehrle force-pushed the dependent_evars branch 2 times, most recently from 5d5393a to 04105f0 Compare September 19, 2019 19:57
jfehrle added a commit that referenced this pull request Feb 14, 2020
jfehrle added a commit that referenced this pull request Feb 18, 2020
jfehrle added a commit that referenced this pull request Feb 23, 2020
jfehrle added a commit that referenced this pull request Feb 25, 2020
jfehrle added a commit that referenced this pull request Mar 6, 2020
jfehrle added a commit that referenced this pull request Mar 7, 2020
jfehrle added a commit that referenced this pull request Mar 13, 2020
jfehrle added a commit that referenced this pull request Mar 13, 2020
jfehrle added a commit that referenced this pull request Mar 20, 2020
jfehrle added a commit that referenced this pull request Mar 22, 2020
jfehrle added a commit that referenced this pull request Mar 24, 2020
jfehrle added a commit that referenced this pull request Apr 2, 2020
jfehrle added a commit that referenced this pull request Apr 3, 2020
jfehrle added a commit that referenced this pull request Apr 3, 2020
jfehrle added a commit that referenced this pull request Apr 3, 2020
jfehrle added a commit that referenced this pull request Apr 3, 2020
jfehrle added a commit that referenced this pull request Apr 20, 2020
jfehrle added a commit that referenced this pull request Apr 29, 2021
jfehrle added a commit that referenced this pull request Jun 16, 2021
jfehrle added a commit that referenced this pull request Jul 15, 2021
jfehrle added a commit that referenced this pull request Aug 12, 2021
jfehrle added a commit that referenced this pull request Aug 23, 2021
jfehrle added a commit that referenced this pull request Aug 24, 2021
jfehrle added a commit that referenced this pull request Oct 1, 2021
jfehrle added a commit that referenced this pull request Oct 11, 2021
jfehrle added a commit that referenced this pull request Oct 12, 2021
jfehrle added a commit that referenced this pull request Oct 12, 2021
jfehrle added a commit that referenced this pull request Nov 1, 2021
jfehrle pushed a commit that referenced this pull request Nov 15, 2021
The conclusion of WF-MOD2 was WF(E; Mod(X:S1[:=S2]))[].

But S2 should not be optional.

In the case that S2 is not given here,
WF-MOD2 is same as WF-MOD1 with meaningless premises for S2.

coq@81f1219
changes the macro \Mod as:

-\newcommand{\Mod}[3]{{\sf Mod}({#1}:{#2}:={#3})}
+\newcommand{\Mod}[3]{{\sf Mod}({#1}:{#2}\,\zeroone{:={#3}})}

So, "[" and "]" added in WF-MOD2 seems accidental.
jfehrle added a commit that referenced this pull request Dec 8, 2021
jfehrle added a commit that referenced this pull request Dec 14, 2021
jfehrle added a commit that referenced this pull request Feb 15, 2022
jfehrle added a commit that referenced this pull request May 28, 2022
jfehrle added a commit that referenced this pull request May 28, 2022
jfehrle added a commit that referenced this pull request May 28, 2022
jfehrle added a commit that referenced this pull request May 28, 2022
jfehrle added a commit that referenced this pull request May 29, 2022
jfehrle added a commit that referenced this pull request Jul 12, 2022
jfehrle added a commit that referenced this pull request Jul 12, 2022
jfehrle added a commit that referenced this pull request Aug 17, 2022
jfehrle added a commit that referenced this pull request Nov 15, 2022
jfehrle added a commit that referenced this pull request Dec 10, 2022
jfehrle added a commit that referenced this pull request Dec 22, 2022
jfehrle added a commit that referenced this pull request Apr 4, 2023
jfehrle added a commit that referenced this pull request Apr 13, 2023
jfehrle pushed a commit that referenced this pull request Jun 5, 2024
For instance

Reserved Notation "#0 #1" (at level 30).
Reserved Notation "#0 #1 #2" (at level 40).
(* Warning: Notations "#0 #1" defined at level 30 and "#0 #1 #2" defined
at level 40 have incompatible prefixes.
[prefix-incompatible-level,parsing,default] *)

Reserved Notation "coq#20 coq#21 x #3 y" (x at level 30, at level 50).
Reserved Notation "coq#20 coq#21 x coq#34" (x at level 40, at level 50).
(* Warning: Notations "coq#20 coq#21 _ #3 _" defined at level 50 with
arguments constr at level 30 and "coq#20 coq#21 _ coq#34" defined at level 50
with arguments constr at level 40 have incompatible
prefixes. [prefix-incompatible-level,parsing,default] *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants