Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
personoj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
koizel
personoj
Commits
b0fd725e
Commit
b0fd725e
authored
5 years ago
by
gabrielhdt
Browse files
Options
Downloads
Patches
Plain Diff
nat & rat
parent
5a8a3786
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
adlib/cert_f/nat.lp
+12
-5
12 additions, 5 deletions
adlib/cert_f/nat.lp
sandbox/cert_f/rat.lp
+20
-16
20 additions, 16 deletions
sandbox/cert_f/rat.lp
with
32 additions
and
21 deletions
adlib/cert_f/nat.lp
+
12
−
5
View file @
b0fd725e
require open encodings.cert_f prelude.cert_f.booleans
prelude.cert_f.equalities prelude.cert_f.notequal
prelude.cert_f.naturalnumbers
require open encodings.cert_f adlib.cert_f.booleans
prelude.cert_f.logic
constant symbol nat: Term uType
injective symbol succ: Term nat ⇒ Term nat
constant symbol zero: Term nat
set builtin "0" ≔ zero
set builtin "+1" ≔ succ
symbol times : Term nat ⇒ Term nat ⇒ Term nat
symbol plus : Term nat ⇒ Term nat ⇒ Term nat
...
...
@@ -25,14 +30,16 @@ symbol prod_comm (x y: Term nat): Term (eq (times x y) (times y x))
//
definition not_zero ≔ neq 0
type not_zero
symbol prod_not_zero (x y: Term nat):
Term (not_zero x) ⇒ Term (not_zero y) ⇒ Term (not_zero (times x y))
definition nznat ≔
p
sub nat not_zero
definition nznat ≔
eP
sub nat not_zero
// Constructor of nznat
definition nznatc (x: Term nat) (h: Term (not_zero x)) : Term nznat ≔
pair not_zero x h
symbol one_not_zero: Term (not_zero 1)
symbol induction (P: Term nat ⇒ Term bool):
∀n, Term (P 0) ⇒ Term (P (n + 1)) ⇒ ∀m, Term (P m)
This diff is collapsed.
Click to expand it.
sandbox/cert_f/rat.lp
+
20
−
16
View file @
b0fd725e
require open encodings.cert_f prelude.cert_f.booleans
prelude.cert_f.equalities prelude.cert_f.notequal
prelude.cert_f.naturalnumbers prelude.cert_f.int
require open encodings.cert_f adlib.cert_f.booleans
prelude.cert_f.logic
require adlib.cert_f.nat as N
set builtin "0" ≔ N.zero
set builtin "+1" ≔ N.succ
constant symbol rat : Univ Type
constant symbol zero : Term rat
symbol frac : Term nat ⇒ Term N.nznat ⇒ Term rat
symbol frac : Term
N.
nat ⇒ Term N.nznat ⇒ Term rat
set infix 8 "/" ≔ frac
symbol times :
@
Term
Type
rat ⇒
@
Term
Type
rat ⇒
@
Term
Type
rat
symbol times : Term rat ⇒ Term rat ⇒ Term rat
rule times (frac &a &b) (frac &c &d) →
let bv ≔ fst N.not_zero &b in
...
...
@@ -29,22 +31,24 @@ rule rateq (&a / &b) (&c / &d) →
definition onz : Term N.nznat ≔ N.nznatc 1 N.one_not_zero
theorem rrefl (a: Term nat) (b: Term N.nznat):
theorem rrefl (a: Term
N.
nat) (b: Term N.nznat):
Term (rateq (a / b) (a / b))
proof
assume a b
apply N.prod_comm a (fst N.not_zero b)
qed
theorem one_neutral (a: Term nat) (b: Term N.nznat):
Term (rateq (times (a / b) (1 / onz)) (1 / onz))
proof
assume a b
refine N.prod_comm ?p1[a,b] ?p2[a,b]
qed
// theorem right_cancellation (a: Term nat) (b: Term N.nznat):
// Term (rateq (times (a / b) ((fst N.not_zero b) / onz)) (a / onz))
// theorem one_neutral (a: Term N.nat) (b: Term N.nznat):
// Term (rateq (times (a / b) (1 / onz)) (1 / onz))
// proof
// assume a b
// refine Term
// qed
type Term (N.nznat ⊑ N.nat)
type λ(b: Term N.nznat) (pr: Term (N.nznat ⊑ N.nat)),
@↑ N.nznat N.nat pr b
// FIXME explicitness required
theorem right_cancellation (a: Term N.nat) (b: Term N.nznat)
(pr: Term (N.nznat ⊑ N.nat)):
Term (rateq (times (a / b) ((@↑ N.nznat N.nat pr b) / onz)) (a / onz))
proof
qed
// Should generate a TCC to provide [pr]
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