Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Roux
Iris
Commits
1f85ff24
Commit
1f85ff24
authored
4 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
add IsOp instances for addition and min/max
parent
e4980084
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/algebra/frac.v
+6
-1
6 additions, 1 deletion
theories/algebra/frac.v
theories/algebra/numbers.v
+14
-1
14 additions, 1 deletion
theories/algebra/numbers.v
with
20 additions
and
2 deletions
theories/algebra/frac.v
+
6
−
1
View file @
1f85ff24
...
@@ -55,5 +55,10 @@ Proof. done. Qed.
...
@@ -55,5 +55,10 @@ Proof. done. Qed.
Lemma
frac_valid'
(
p
:
Qp
)
:
✓
p
↔
(
p
≤
1
%
Qp
)
%
Qc
.
Lemma
frac_valid'
(
p
:
Qp
)
:
✓
p
↔
(
p
≤
1
%
Qp
)
%
Qc
.
Proof
.
done
.
Qed
.
Proof
.
done
.
Qed
.
Global
Instance
is_op_
frac
q
:
IsOp'
q
(
q
/
2
)
%
Qp
(
q
/
2
)
%
Qp
.
Global
Instance
frac_
is_op_
half
q
:
IsOp'
q
(
q
/
2
)
%
Qp
(
q
/
2
)
%
Qp
.
Proof
.
by
rewrite
/
IsOp'
/
IsOp
frac_op'
Qp_div_2
.
Qed
.
Proof
.
by
rewrite
/
IsOp'
/
IsOp
frac_op'
Qp_div_2
.
Qed
.
(* This one has a higher precendence than [is_op_op] so we get a [+] instead
of an [⋅]. *)
Global
Instance
frac_is_op
q1
q2
:
IsOp
(
q1
+
q2
)
%
Qp
q1
q2
.
Proof
.
done
.
Qed
.
This diff is collapsed.
Click to expand it.
theories/algebra/numbers.v
+
14
−
1
View file @
1f85ff24
...
@@ -40,7 +40,7 @@ Section nat.
...
@@ -40,7 +40,7 @@ Section nat.
(* This one has a higher precendence than [is_op_op] so we get a [+] instead
(* This one has a higher precendence than [is_op_op] so we get a [+] instead
of an [⋅]. *)
of an [⋅]. *)
Global
Instance
is_op
_plus
(
n1
n2
:
nat
)
:
IsOp
(
n1
+
n2
)
n1
n2
.
Global
Instance
nat_
is_op
(
n1
n2
:
nat
)
:
IsOp
(
n1
+
n2
)
n1
n2
.
Proof
.
done
.
Qed
.
Proof
.
done
.
Qed
.
End
nat
.
End
nat
.
...
@@ -93,6 +93,10 @@ Section max_nat.
...
@@ -93,6 +93,10 @@ Section max_nat.
Global
Instance
:
IdemP
(
=@
{
max_nat
})
(
⋅
)
.
Global
Instance
:
IdemP
(
=@
{
max_nat
})
(
⋅
)
.
Proof
.
intros
[
x
]
.
rewrite
max_nat_op_max
.
apply
f_equal
.
lia
.
Qed
.
Proof
.
intros
[
x
]
.
rewrite
max_nat_op_max
.
apply
f_equal
.
lia
.
Qed
.
Global
Instance
max_nat_is_op
(
x
y
:
nat
)
:
IsOp
(
MaxNat
(
x
`
max
`
y
))
(
MaxNat
x
)
(
MaxNat
y
)
.
Proof
.
done
.
Qed
.
End
max_nat
.
End
max_nat
.
(** ** Natural numbers with [min] as the operation. *)
(** ** Natural numbers with [min] as the operation. *)
...
@@ -145,6 +149,10 @@ Section min_nat.
...
@@ -145,6 +149,10 @@ Section min_nat.
Global
Instance
:
IdemP
(
=@
{
min_nat
})
(
⋅
)
.
Global
Instance
:
IdemP
(
=@
{
min_nat
})
(
⋅
)
.
Proof
.
intros
[
x
]
.
rewrite
min_nat_op_min
.
apply
f_equal
.
lia
.
Qed
.
Proof
.
intros
[
x
]
.
rewrite
min_nat_op_min
.
apply
f_equal
.
lia
.
Qed
.
Global
Instance
min_nat_is_op
(
x
y
:
nat
)
:
IsOp
(
MinNat
(
x
`
min
`
y
))
(
MinNat
x
)
(
MinNat
y
)
.
Proof
.
done
.
Qed
.
End
min_nat
.
End
min_nat
.
(** ** Positive integers with [Pos.add] as the operation. *)
(** ** Positive integers with [Pos.add] as the operation. *)
...
@@ -175,4 +183,9 @@ Section positive.
...
@@ -175,4 +183,9 @@ Section positive.
intros
y
??
.
apply
(
Pos
.
add_no_neutral
x
y
)
.
rewrite
Pos
.
add_comm
.
intros
y
??
.
apply
(
Pos
.
add_no_neutral
x
y
)
.
rewrite
Pos
.
add_comm
.
by
apply
leibniz_equiv
.
by
apply
leibniz_equiv
.
Qed
.
Qed
.
(* This one has a higher precendence than [is_op_op] so we get a [+] instead
of an [⋅]. *)
Global
Instance
pos_is_op
(
x
y
:
positive
)
:
IsOp
(
x
+
y
)
%
positive
x
y
.
Proof
.
done
.
Qed
.
End
positive
.
End
positive
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment