Ahhh fucking substitution
I'm dumb
This commit is contained in:
parent
c4f0f723f5
commit
b4090ae2cf
|
@ -527,7 +527,6 @@
|
||||||
(term (constructors-for ,sigma false))
|
(term (constructors-for ,sigma false))
|
||||||
(term ())))
|
(term ())))
|
||||||
|
|
||||||
|
|
||||||
;; Holds when an apply context Θ provides arguments that match the
|
;; Holds when an apply context Θ provides arguments that match the
|
||||||
;; telescope Ξ
|
;; telescope Ξ
|
||||||
(define-judgment-form cic-typingL
|
(define-judgment-form cic-typingL
|
||||||
|
@ -736,6 +735,12 @@
|
||||||
(nat-test (∅ n : nat)
|
(nat-test (∅ n : nat)
|
||||||
(((((elim nat) n) (λ (x : nat) nat)) zero) (λ (x : nat) (λ (ih-x : nat) x)))
|
(((((elim nat) n) (λ (x : nat) nat)) zero) (λ (x : nat) (λ (ih-x : nat) x)))
|
||||||
nat)
|
nat)
|
||||||
|
(check-true
|
||||||
|
(judgment-holds
|
||||||
|
(types (,Σ (bool : (Unv 0) ((btrue : bool) (bfalse : bool))))
|
||||||
|
(∅ n2 : nat)
|
||||||
|
(((((elim nat) n2) (λ (x : nat) bool)) btrue) (λ (x : nat) (λ (ih-x : bool) bfalse)))
|
||||||
|
bool)))
|
||||||
(check-false (judgment-holds
|
(check-false (judgment-holds
|
||||||
(types ,Σ
|
(types ,Σ
|
||||||
∅
|
∅
|
||||||
|
@ -806,6 +811,27 @@
|
||||||
(λ (a : A)
|
(λ (a : A)
|
||||||
(λ (b : B) tt)))))
|
(λ (b : B) tt)))))
|
||||||
true)))
|
true)))
|
||||||
|
(check-true
|
||||||
|
(judgment-holds
|
||||||
|
(types (,Σ4 (true : (Unv 0) ((tt : true)))) ∅
|
||||||
|
(λ (A : Type) (λ (B : Type) (λ (x : ((and A) B)) ((and B) A))))
|
||||||
|
(Π (A : (Unv 0)) (Π (B : (Unv 0)) (Π (x : ((and A) B)) (Unv 0)))))))
|
||||||
|
(check-true
|
||||||
|
(judgment-holds
|
||||||
|
(types (,Σ4 (true : (Unv 0) ((tt : true))))
|
||||||
|
((∅ A : Type) B : Type)
|
||||||
|
(conj B)
|
||||||
|
t) t))
|
||||||
|
(check-true
|
||||||
|
(judgment-holds (types (,Σ4 (true : (Unv 0) ((tt : true)))) ∅
|
||||||
|
((((elim and) ((((conj true) true) tt) tt))
|
||||||
|
(λ (A : Type) (λ (B : Type) (λ (x : ((and A) B))
|
||||||
|
((and B) A)))))
|
||||||
|
(λ (A : (Unv 0))
|
||||||
|
(λ (B : (Unv 0))
|
||||||
|
(λ (a : A)
|
||||||
|
(λ (b : B) ((((conj B) A) b) a))))))
|
||||||
|
((and true) true))))
|
||||||
(define gamma (term (∅ temp863 : pre)))
|
(define gamma (term (∅ temp863 : pre)))
|
||||||
(check-true (judgment-holds (wf ,sigma ∅)))
|
(check-true (judgment-holds (wf ,sigma ∅)))
|
||||||
(check-true (judgment-holds (wf ,sigma ,gamma)))
|
(check-true (judgment-holds (wf ,sigma ,gamma)))
|
||||||
|
|
|
@ -31,17 +31,18 @@
|
||||||
(check-equal? (plus z z) z)
|
(check-equal? (plus z z) z)
|
||||||
(check-equal? (plus (s (s z)) (s (s z))) (s (s (s (s z))))))
|
(check-equal? (plus (s (s z)) (s (s z))) (s (s (s (s z))))))
|
||||||
|
|
||||||
(define (nat-equal? (n1 : nat) (n2 : nat) : bool)
|
(define (nat-equal? (n1 : nat) (n2 : nat))
|
||||||
(case* nat n1 (lambda (x : nat) bool)
|
(case* nat n1 (lambda (x : nat) bool)
|
||||||
[z (case* nat n2 (lambda (x : nat) bool)
|
[z (case* nat n2 (lambda (x : nat) bool)
|
||||||
[z btrue]
|
[z btrue]
|
||||||
[(s (x : nat)) IH: ((ih-x : bool)) bfalse])]
|
[(s (x : nat)) IH: ((ih-x : bool)) bfalse])]
|
||||||
|
;; TODO: Can't finish correct definition due to issues with names
|
||||||
[(s (x : nat)) IH: ((ih-x : bool))
|
[(s (x : nat)) IH: ((ih-x : bool))
|
||||||
(case* nat n2 (lambda (x : nat) bool)
|
(case* nat n2 (lambda (x : nat) bool)
|
||||||
[z bfalse]
|
[z bfalse]
|
||||||
[(s (x : nat)) IH: ((ih-x : bool))
|
[(s (x : nat)) IH: ((ih-x : bool))
|
||||||
ih-x])]))
|
ih-x])]))
|
||||||
(module+ test
|
(module+ test
|
||||||
(check-equal? btrue (nat-equal? z z))
|
(check-equal? (nat-equal? z z) btrue)
|
||||||
(check-equal? bfalse (nat-equal? z (s z)))
|
(check-equal? (nat-equal? z (s z)) bfalse)
|
||||||
(check-equal? btrue (nat-equal? (s z) (s z))))
|
(check-equal? (nat-equal? (s z) (s z)) btrue))
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
(define-theorem thm:and-is-symmetric
|
(define-theorem thm:and-is-symmetric
|
||||||
(forall* (P : Type) (Q : Type) (ab : (and P Q)) (and Q P)))
|
(forall* (P : Type) (Q : Type) (ab : (and P Q)) (and Q P)))
|
||||||
|
|
||||||
;; TODO: BAH! pattern matching on inductive families is still broken.
|
|
||||||
(define proof:and-is-symmetric
|
(define proof:and-is-symmetric
|
||||||
(lambda* (P : Type) (Q : Type) (ab : (and P Q))
|
(lambda* (P : Type) (Q : Type) (ab : (and P Q))
|
||||||
(case* ab
|
(case* and ab
|
||||||
|
(lambda* (P : Type) (Q : Type) (ab : (and P Q))
|
||||||
|
(and Q P))
|
||||||
((conj (P : Type) (Q : Type) (x : P) (y : Q)) (conj Q P y x)))))
|
((conj (P : Type) (Q : Type) (x : P) (y : Q)) (conj Q P y x)))))
|
||||||
|
|
||||||
#;(qed thm:and-is-symmetric proof:and-is-symmetric)
|
#;(qed thm:and-is-symmetric proof:and-is-symmetric)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user