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

Streamline proofs #22

Open
clayrat opened this issue Oct 5, 2017 · 5 comments
Open

Streamline proofs #22

clayrat opened this issue Oct 5, 2017 · 5 comments

Comments

@clayrat
Copy link
Collaborator

clayrat commented Oct 5, 2017

Inequalities:

@clayrat clayrat changed the title Streamline inequalities Streamline proofs Oct 12, 2017
@clayrat
Copy link
Collaborator Author

clayrat commented Oct 12, 2017

@clayrat
Copy link
Collaborator Author

clayrat commented Oct 14, 2017

Order of multiplication in the divMod-style proofs: in some places it's b*q+r, in others it's q*b+r; would be nice to choose a single style (personally I like q*b+r more) to avoid extra mulComms.

@clayrat
Copy link
Collaborator Author

clayrat commented Oct 15, 2017

Introduce lemmas to do rewrites like a 'compare' (b+c) = (a-c) 'compare' b directly, without addAssoc and posSubDiag

@clayrat
Copy link
Collaborator Author

clayrat commented Nov 14, 2017

Try to simplify *Spec types by removing explicit equalities ala:

%default total

data NatM = NatO | NatP Nat | NatN

data NatMSpec : (p, q : Nat) -> (m : NatM) -> Type where
  SubIsNul :              NatMSpec p p NatO
  SubIsPos : q + r = p -> NatMSpec p q (NatP r)
  SubIsNeg : p + r = q -> NatMSpec p q NatN

minusM : Nat -> Nat -> NatM
minusM Z        Z         = NatO
minusM Z        (S _)     = NatN
minusM left     Z         = NatP left
minusM (S left) (S right) = minusM left right

minusSpec_step : NatMSpec p q s -> NatMSpec (S p) (S q) s
minusSpec_step SubIsNul = SubIsNul
minusSpec_step (SubIsPos eq) = SubIsPos (cong eq)
minusSpec_step (SubIsNeg eq) = SubIsNeg (cong eq)

minusSpec : (p, q : Nat) -> NatMSpec p q (minusM p q)
minusSpec Z Z = SubIsNul
minusSpec Z (S k) = SubIsNeg {r=S k} Refl
minusSpec (S k) Z = SubIsPos Refl
minusSpec (S k) (S j) = minusSpec_step (minusSpec k j)

or even

SubIsPos : NatMSpec (q + r) q (NatP r)

@clayrat
Copy link
Collaborator Author

clayrat commented Nov 28, 2017

Try wrapping signed (and unsigned?) in records to prevent over-normalization a-la Box in https://gallais.github.io/pdf/agdarsec17.pdf

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

No branches or pull requests

1 participant