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

Typechecker confuses constants included from parametric theory and fails #530

Open
ComFreek opened this issue Aug 1, 2020 · 1 comment
Assignees
Labels
bug help wanted type checker Bugs related to the typechecker (incl. false positives and false negatives)

Comments

@ComFreek
Copy link
Member

ComFreek commented Aug 1, 2020

@florian-rabe Can you have a look at this? @Jazzpirate said we would need your help for resolving this. Currently, this is a semi-blocking issue for FrameIT.

How to reproduce

MitM/core defines points and lines a modular way. It starts with the 3DGeometry theory

theory 3DGeometry =
  include ☞base:?ProductTypes ❙
  include ?Geometry ❙

  point = ℝ × ℝ × ℝ ❙
  [...]
  include (?Geometry/Common point point_addI point_subtractI vec_multI scalar_productI) ❙
  [...]

that in turn includes the parametric Geometry/Common theory:

theory Geometry =
  include ☞arith:?RealArithmetics ❙
  include ☞base:?Trigonometry ❙

  theory Common > point : type,
        add : point ⟶ point ⟶ point,
        subtract : point ⟶ point ⟶ point,
        mult : ℝ ⟶ point ⟶ point,
        scp : point ⟶ point ⟶ ℝ ❘ =

      [...]

      line_type : type ❘ # line ❙
      lineOf : point ⟶ point ⟶ line ❘ # from 1 to 2 ❙

With that setup the following fails to typecheck (e.g. in as seen in the Examples theory of our FrameIT/frameworld repository.)

theory Examples =
  A: point ❘ = ⟨1.0, 2.0, 3.0⟩❙
  B: point ❘ = ⟨4.0, 5.0, 6.0⟩❙

  // this doesn't typecheck due to an MMT bug ❙
  line_AB: line_type ❘ = lineOf A B ❙
❚

Error:

error while adding successfully parsed element http://mathhub.info/FrameIT/frameworld/examples?Examples?line_AB: variable point not declared in context http://mathhub.info/FrameIT/frameworld?ScrollMeta, http://mathhub.info/FrameIT/frameworld/examples?Examples

@ComFreek ComFreek added bug help wanted type checker Bugs related to the typechecker (incl. false positives and false negatives) labels Aug 1, 2020
@ComFreek
Copy link
Member Author

ComFreek commented Aug 3, 2020

Example of non-reproducing sample (it typechecks fine):

namespace http://mathhub.info/FrameIT/frameworld/examples/bug-repro ❚

fixmeta ur:?LF ❚

theory Outer =
  theory Inner : ur:?LF > point : type ❘ =
    aline_type : type ❙
    alineOf: point ⟶ point ⟶ aline_type ❙
  ❚

  point: type ❙
  include (?Outer/Inner point) ❙

  A: point ❙
  B: point ❙
  sampleLine: aline_type ❘= alineOf A B ❙
❚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted type checker Bugs related to the typechecker (incl. false positives and false negatives)
Projects
None yet
Development

No branches or pull requests

2 participants