Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aymanosman/d237e5d8b7ee3cb34c0a6e70838777fb to your computer and use it in GitHub Desktop.
Save aymanosman/d237e5d8b7ee3cb34c0a6e70838777fb to your computer and use it in GitHub Desktop.
There seams to be subtle differences between how the two inductive principles are set up in Coq vs Pie
#lang pie
(claim +
(-> Nat Nat
Nat))
(define +
(λ (a b)
(rec-Nat a
b
(λ (_ h)
(add1 h)))))
(claim double
(-> Nat
Nat))
(define double (lambda (n) (+ n n)))
(claim plus_id_ex
(Pi ((n Nat)
(m Nat))
(-> (= Nat n m) (= Nat (+ n n) (+ m m)))))
(define plus_id_ex
(lambda (n m n=m) ;; This is the same as `fun (n m: nat) (H : n = m)`
#;;This is enough
(cong n=m double)
#;;This also works
(replace n=m
(lambda (m0) (= Nat (+ n n) (+ m0 m0)))
(same (+ n n)))
(ind-= n=m ;; This is the same as `eq_ind`,
;; except it accepts the Prop as argument instead of the nat
(lambda (m0 _) (= Nat (+ n n) (+ m0 m0))) ;; This is the same motive
(same (+ n n))))) ;; this is the same as `eq_refl`
;plus_id_ex =
;fun (n m : nat) (H : n = m) => eq_ind n (fun m0 : nat => n + n = m0 + m0) eq_refl m H
; : forall n m : nat, n = m -> n + n = m + m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment