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 morphism instances for N.to_nat and N.of_nat #48

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions theories/ssrZ.v
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,47 @@ HB.instance Definition _ := GRing.isSemiAdditive.Build N nat nat_of_bin
nat_of_bin_is_semi_additive.

Fact bin_of_nat_is_multiplicative : multiplicative bin_of_nat.
Proof. by split => // m n; rewrite /GRing.mul /=; lia. Qed.
Proof. by split=> // m n; rewrite /GRing.mul /=; lia. Qed.

#[export]
HB.instance Definition _ := GRing.isMultiplicative.Build nat N bin_of_nat
bin_of_nat_is_multiplicative.

Fact nat_of_bin_is_multiplicative : multiplicative nat_of_bin.
Proof. exact: can2_rmorphism bin_of_natK nat_of_binK. Qed.
Proof. by split=> // m n; rewrite /GRing.mul /=; lia. Qed.

#[export]
HB.instance Definition _ := GRing.isMultiplicative.Build N nat nat_of_bin
nat_of_bin_is_multiplicative.

Fact N_of_nat_is_semi_additive : semi_additive N.of_nat.
Proof. by split=> //= m n; rewrite /GRing.add /=; lia. Qed.

#[export]
HB.instance Definition _ := GRing.isSemiAdditive.Build nat N N.of_nat
N_of_nat_is_semi_additive.

Fact N_to_nat_is_semi_additive : semi_additive N.to_nat.
Proof. by split=> //= m n; rewrite /GRing.add /=; lia. Qed.

#[export]
HB.instance Definition _ := GRing.isSemiAdditive.Build N nat N.to_nat
N_to_nat_is_semi_additive.

Fact N_of_nat_is_multiplicative : multiplicative N.of_nat.
Proof. by split=> // m n; rewrite /GRing.mul /=; lia. Qed.

#[export]
HB.instance Definition _ := GRing.isMultiplicative.Build nat N N.of_nat
N_of_nat_is_multiplicative.

Fact N_to_nat_is_multiplicative : multiplicative N.to_nat.
Proof. by split=> // m n; rewrite /GRing.mul /=; lia. Qed.

#[export]
HB.instance Definition _ := GRing.isMultiplicative.Build N nat N.to_nat
N_to_nat_is_multiplicative.

Implicit Types (m n : Z).

Fact eqZP : Equality.axiom Z.eqb.
Expand Down