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

Add inference for #917 #927

Merged
merged 4 commits into from
May 19, 2021
Merged

Conversation

matwojcik
Copy link
Contributor

Agreed with @kubukoz that this PR will replace his #919.

I've suggested some naming, made one of inferences more generic, and added scala 3.0+ version.

@codecov
Copy link

codecov bot commented Mar 10, 2021

Codecov Report

Merging #927 (ea46a0a) into master (b9b027b) will increase coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #927      +/-   ##
==========================================
+ Coverage   91.63%   91.75%   +0.12%     
==========================================
  Files          49       49              
  Lines         538      546       +8     
  Branches       12        5       -7     
==========================================
+ Hits          493      501       +8     
  Misses         45       45              
Impacted Files Coverage Δ
...n/scala/eu/timepit/refined/scalacheck/string.scala 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9b027b...ea46a0a. Read the comment docs.

@kubukoz kubukoz mentioned this pull request Mar 10, 2021
@@ -5,6 +5,8 @@ import eu.timepit.refined.api.Inference
import eu.timepit.refined.boolean._
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm kinda worried that this file is only in scala-3.0- 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

p1: B ==> C,
p2: A ==> C
): (A Or B) ==> C =
Inference.combine(p1, p2, "disjunctionElimination")
Copy link
Contributor

Choose a reason for hiding this comment

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

Combine is "and", did you mean to make this use "or"? (as we discussed, probably rqeuires a new method)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, but we were wrong :) In order to imply that A Or B can be replaced by C, both A and C needs to be equivalents of C.

Here is the truth table for OR option:

  A B C  │  ((B ↔ C) ∨ (A ↔ C)) → ((A ∨ B) ↔ C)
  ───────┼─────────────────────────────────────
  1 1 1  │      1    1    1    *1     1    1   
  1 1 0  │      0    0    0    *1     1    0   
  1 0 1  │      0    1    1    *1     1    1   
  1 0 0  │      1    1    0    *0     1    0   
  0 1 1  │      1    1    0    *1     1    1   
  0 1 0  │      0    1    1    *0     1    0   
  0 0 1  │      0    0    0    *1     0    0   
  0 0 0  │      1    1    1    *1     0    1  

@matwojcik
Copy link
Contributor Author

@fthomas could you review this please?

Copy link
Owner

@fthomas fthomas left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @matwojcik and @kubukoz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants