Changes
8 changed files (+78/-37)
-
-
-
-
-
-
-
@@ -73,40 +73,3 @@!(def not_ab_imp_not_a (cons (list 11n (cons (list 11n (cons (list 12n (cons (list 10n 1) (list 1n (list 3n (list 0n 0n) (list 0n 1n)) '(5n))) (cons (list 16n (cons (list 10n 0) (list 0n 0n))) (list 3n (list 0n 0n) (list 0n 1n)))) '(5n))) (list 1n (list 0n 0n) '(5n)))) (list 1n (list 1n (list 3n (list 0n 0n) (list 0n 1n)) '(5n)) (list 1n (list 0n 0n) '(5n))))) (check nil (car not_ab_imp_not_a) (cdr not_ab_imp_not_a)) ;; Currently broken !(defprotocol not_ab_imp_not_a_protocol (term) (cons ;; claim definition (cons (cons (list 'check (empty-env) term (cdr not_ab_imp_not_a)) (current-env)) t) ;; post-verification predicate is not provided nil) :description "¬(A ∨ B) → ¬A") !(dump-expr not_ab_imp_not_a_protocol "protocol") !(prove-protocol not_ab_imp_not_a_protocol "protocol-proof" (car not_ab_imp_not_a)) ;; ;; A protocol that requires knowledge of a hash that opens to a pair such that ;; ;; its components add up to 30. If the proof is accepted, further require that ;; ;; the first component of the pair be greater than 10. ;; !(defprotocol my-protocol (hash pair) ;; (cons ;; (if (= (+ (car pair) (cdr pair)) 30) ;; (cons (cons (cons 'open (cons hash nil)) (empty-env)) pair) ;; nil) ;; (lambda () (> (car pair) 10))) ;; :description "hash opens to a pair (a, b) s.t. a+b=30 and a>10") ;; ;; This is the prover's pair, whose hash is ;; ;; #c0x955f855f302a30ed988cc48685c442ebd98c8711e989fc64df8f27f52e1350 ;; (commit '(13 . 17)) ;; ;; Let's prove it and write the proof to the file protocol-proof ;; !(prove-protocol my-protocol ;; "protocol-proof" ;; #c0x955f855f302a30ed988cc48685c442ebd98c8711e989fc64df8f27f52e1350 ;; '(13 . 17)) ;; ;; Now it can be verified ;; !(verify-protocol my-protocol "protocol-proof")
-
-
-
protocol2.lurk (new)
-
@@ -0,0 +1,78 @@;; load muLean ;; !(load "a.lurk") ;; !(def statement (list 1n (list 1n (list 3n (list 0n 0n) (list 0n 1n)) '(5n)) (list 1n (list 0n 0n) '(5n)))) !(def not_not_not_a_imp_not_a_solution (list 11n (cons (list 11n (cons (list 12n (cons (list 10n 1) (list 1n (list 1n (list 1n (list 0n 0n) '(5n)) '(5n)) '(5n))) (cons (list 12n (cons (list 11n (cons (list 11n (cons (list 12n (cons (list 10n 0) (list 1n (list 0n 0n) '(5n))) (cons (list 10n 1) (list 0n 0n))) '(5n))) (list 1n (list 1n (list 0n 0n) '(5n)) '(5n)))) (list 1n (list 0n 0n) (list 1n (list 1n (list 0n 0n) '(5n)) '(5n)))) (cons (list 10n 0) (list 0n 0n))) (list 1n (list 1n (list 0n 0n) '(5n)) '(5n)))) '(5n))) (list 1n (list 0n 0n) '(5n))))) !(def comm_term_test (hide #0x2903850943570 not_not_not_a_imp_not_a_solution)) ;; (eval (emit ( ;; list 'check nil (list 'open 'comm_term_test) 'statement ;; )) (current-env)) !(defprotocol not_not_not_a_imp_not_a_protocol (comm_term) (cons ;; claim definition (cons (cons ;; expression ;; needs to be a quoted syntax tree (list 'check nil (list 'open comm_term) 'statement) ;; environment (letrec ( (arg1 (lambda (x) (car (cdr x)))) (arg1a (lambda (x) (car (arg1 x)))) (arg1b (lambda (x) (cdr (arg1 x)))) (arg2 (lambda (x) (car (cdr (cdr x))))) (arg2a (lambda (x) (car (arg2 x)))) (arg2b (lambda (x) (cdr (arg2 x)))) (and (lambda (x y) (if x (if y t nil) nil))) (or (lambda (x y) (if x t (if y t nil)))) (geti (lambda (xs i) (if (= i 0) (car xs) (geti (cdr xs) (- i 1))))) (check (lambda (env term typ) ;; Variable (if (= (car term) 10n) (eq typ (geti env (arg1 term))) ;; Lambda (if (and (= (car term) 11n) (= (car typ) 1n)) (and (eq (arg2 typ) (arg1b term)) (check (cons (arg1 typ) env) (arg1a term) (arg1b term))) ;; Application (if (and (= (car term) 12n) (= (car (arg1b term)) 1n)) (and (eq (arg1 (arg1b term)) (arg2b term)) (and (eq (arg2 (arg1b term)) typ) (and (check env (arg1a term) (arg1b term)) (check env (arg2a term) (arg2b term))))) ;; And (if (and (= (car term) 13n) (= (car typ) 2n)) (and (eq (arg1b term) (arg1 typ)) (and (eq (arg2b term) (arg2 typ)) (and (check env (arg1a term) (arg1b term)) (check env (arg2a term) (arg2b term))))) ;; And1 (if (and (= (car term) 14n) (= (car (arg1b term)) 2n)) (and (eq (arg1 (arg1b term)) typ) (check env (arg1a term) (arg1b term))) ;; And2 (if (and (= (car term) 15n) (= (car (arg1b term)) 2n)) (and (eq (arg2 (arg1b term)) typ) (check env (arg1a term) (arg1b term))) ;; Or (if (and (= (car term) 16n) (= (car typ) 3n)) (and (or (eq (arg1b term) (arg1 typ)) (eq (arg1b term) (arg2 typ))) (check env (arg1a term) (arg1b term))) ;; False elim (if (and (= (car term) 20n) (eq (car (arg1b term)) 5n)) t nil)))))))))) (statement (list 1n (list 1n (list 1n (list 1n (list 0n 0n) '(5n)) '(5n)) '(5n)) (list 1n (list 0n 0n) '(5n)))) ) (current-env)) ) ;; expected output t ) ;; post-verification predicate nil) :description "¬¬¬A → ¬A") !(dump-expr not_not_not_a_imp_not_a_protocol "files/not_not_not_a_imp_not_a_protocol") !(defq not_not_not_a_imp_not_a_protocol_loaded !(load-expr "files/not_not_not_a_imp_not_a_protocol")) !(prove-protocol not_not_not_a_imp_not_a_protocol_loaded "files/not_not_not_a_imp_not_a_proof" comm_term_test) !(inspect "10662522c024b18140b63a5159dc46cdc268e367a5a2a08b0d9e486b9b6201") !(verify-protocol not_not_not_a_imp_not_a_protocol_loaded "files/not_not_not_a_imp_not_a_proof")
-