Skip to content

added current goal info to dependent evars line#2

Open
hendriktews wants to merge 3 commits intojfehrle:dependent_evarsfrom
hendriktews:dependent_evars
Open

added current goal info to dependent evars line#2
hendriktews wants to merge 3 commits intojfehrle:dependent_evarsfrom
hendriktews:dependent_evars

Conversation

@hendriktews
Copy link
Copy Markdown

  • 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
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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.

in
cut () ++ cut () ++
str "(dependent evars: " ++ evars_pp ++ str ";" ++ cut () ++
str "mapping: " ++ (pr_map sigma map_evars) ++ str ")"
Copy link
Copy Markdown
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
Copy Markdown
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 rocq-prover/rocq#10420

@hendriktews
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 rocq-prover#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 rocq-prover#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 Sep 29, 2020
jfehrle added a commit that referenced this pull request Sep 29, 2020
jfehrle added a commit that referenced this pull request Oct 7, 2020
jfehrle added a commit that referenced this pull request Oct 12, 2020
jfehrle added a commit that referenced this pull request Oct 14, 2020
jfehrle added a commit that referenced this pull request Oct 15, 2020
jfehrle added a commit that referenced this pull request Oct 17, 2020
jfehrle added a commit that referenced this pull request Oct 20, 2020
jfehrle added a commit that referenced this pull request Nov 3, 2020
jfehrle added a commit that referenced this pull request Nov 5, 2020
jfehrle added a commit that referenced this pull request Nov 8, 2020
jfehrle added a commit that referenced this pull request Nov 8, 2020
jfehrle added a commit that referenced this pull request Nov 10, 2020
jfehrle added a commit that referenced this pull request Nov 15, 2020
jfehrle added a commit that referenced this pull request Nov 16, 2020
jfehrle added a commit that referenced this pull request Nov 17, 2020
jfehrle added a commit that referenced this pull request Nov 20, 2020
jfehrle added a commit that referenced this pull request Nov 23, 2020
jfehrle added a commit that referenced this pull request Dec 4, 2020
jfehrle added a commit that referenced this pull request Dec 12, 2020
jfehrle added a commit that referenced this pull request Dec 19, 2020
jfehrle added a commit that referenced this pull request Dec 24, 2020
jfehrle added a commit that referenced this pull request Feb 1, 2021
jfehrle added a commit that referenced this pull request Feb 1, 2021
jfehrle added a commit that referenced this pull request Feb 8, 2021
jfehrle added a commit that referenced this pull request Feb 13, 2021
jfehrle added a commit that referenced this pull request Feb 20, 2021
jfehrle added a commit that referenced this pull request Feb 28, 2021
jfehrle added a commit that referenced this pull request Mar 2, 2021
jfehrle added a commit that referenced this pull request Mar 10, 2021
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